fuliver123

Tam giรกc Pascal

Dec 12th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3.  
  4. int pas(int x, int y)
  5. {
  6.     if (y==1 || y==x) return 1;
  7.     return pas(x-1,y-1)+pas(x-1,y);
  8. }
  9.  
  10. int main()
  11. {
  12.     int i,j,n;
  13.     printf("Nhap vao so n: "); scanf("%d",&n);
  14.    
  15.     for (i=1;i<=n+1;i++)
  16.     {
  17.         for (j=1;j<=i;j++)
  18.             printf("%3d ",pas(i,j));
  19.         printf("\n");
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment