Home > Back-end >  Output line 15 Yang hui triangle. Turn to for help is wrong
Output line 15 Yang hui triangle. Turn to for help is wrong

Time:12-03

# include
Int main ()
{
Int a [16] [16], I, j;
for(i=1; i<=15; I++)
{
for(j=1; j<=15; J++)
{
If (j==1)
A [I] [j]=1;
The else
{
If (j> I)
{a [I] [j]=0; break; }
Else a [I] [j]=[j] + [I - 1] a [I] a [j - 1);

} the if (a [I] [j]=! 0)
Printf (" % d ", a [I] [j]);
} printf (" \ n ");
} return 0;
}

CodePudding user response:

1, the if (a [I] [j]=! 0) to if (a [I] [j].=0)
2, the else a [I] [j]=[j] + [I - 1] a [I] a [j - 1); Change the else a [I] [j]=[j] [I - 1] a + a] [I - 1 [j - 1);

CodePudding user response:

 # include & lt; stdio.h> 
Int main ()
{
Int a [16] [16], I, j;
For (I=1; I & lt;=15; I++)
{
For (j=1; j <=15; J++)
{
If (j==1)
A [I] [j]=1;
The else
{
If (j & gt; I)
{
A [I] [j]=0;
break;
}
The else
//a [I] [j]=[j] + [I - 1] a [I] a [j - 1);
A [I] [j]=[I - 1] a [j - 1) + a, [I - 1) [j].
}
//if (a [I] [j]=! 0)
If (a [I] [j].=0)
Printf (" % 3 d ", a [I] [j]);
}
printf("\n");
}
return 0;
}
  • Related