Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Visitez notre page
- www.facebook.com/MOBY.c00
- */
- #include <stdio.h>
- #include <stdlib.h>
- //#define MAX 7
- int main()
- {
- //int t[MAX][MAX];
- int i,j,taille;
- printf("Donnez la taille de la matrice carree pour afficher le triangle de pascal : ");
- scanf("%d",&taille);
- int t[taille][taille];
- t[0][0]=1;
- for(i=0;i<taille;i++)
- for(j=1;j<=i;j++)
- {
- t[i][0]=1;
- if(i==j)
- {
- t[i][j]=1;
- break;
- }else
- t[i][j]=t[i-1][j-1]+t[i-1][j];
- }
- for(i=0;i<taille;i++)
- {
- for(j=0;j<=i;j++)
- printf("%d ",t[i][j]);
- printf("\n");
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment