Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define TAILLE 100
- main(){
- int i,j,ordre;
- int triangle [TAILLE][TAILLE];
- do{
- system ("CLS");
- printf ("\nTriangle de Pascal");
- printf ("\n\nOrdre de votre triangle: ");
- scanf ("%d", &ordre);
- } while(ordre <0 || ordre > TAILLE);
- for(i=0;i<=ordre;i++){
- triangle [i][0]= 1;
- triangle [i][i]= 1;
- }for(i=2;i<=ordre;i++){
- for(j=1;j<=ordre;j++){
- triangle[i][j] = (triangle[i-1][j-1]+triangle[i-1][j]);
- }
- }
- for(i=0;i<=ordre;i++){
- printf("\n|");
- for(j=0;j<ordre;j++){
- printf("%5d" ,triangle [i][j]);
- triangle [i][j] = (triangle[i][j]);
- }
- printf(" |");
- printf("\n\n");
- }
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement