TP
This commit is contained in:
BIN
Dev1.1/Dev1910/Triangle
Executable file
BIN
Dev1.1/Dev1910/Triangle
Executable file
Binary file not shown.
27
Dev1.1/Dev1910/Triangle.c
Normal file
27
Dev1.1/Dev1910/Triangle.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int P[30][30];
|
||||
int N = 30 ;
|
||||
int I, J;
|
||||
while (N>30||N<0);
|
||||
for (I=0; I<=N; I++)
|
||||
{
|
||||
P[I][I]=1;
|
||||
P[I][0]=1;
|
||||
for (J=1; J<I; J++)
|
||||
P[I][J] = P[I-1][J] + P[I-1][J-1];
|
||||
}
|
||||
|
||||
printf("Triangle de Pascal de degré %d :\n", N);
|
||||
for (I=0; I<=N; I++)
|
||||
{
|
||||
printf(" N=%2d", I);
|
||||
for (J=0; J<=I; J++)
|
||||
if (P[I][J])
|
||||
printf("%5d", P[I][J]);
|
||||
printf("\n");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user