Advertisement
Specowy

Pascal

Oct 21st, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. long fact(int);
  4.  
  5. int main()
  6. {
  7.    int i, n, c;
  8.  
  9.    printf("wprowadลบ liczbฤ™ wierszye\n");
  10.    scanf("%d",&n);
  11.  
  12.    for (i = 0; i < n; i++)
  13.    {
  14.       for (c = 0; c <= (n - i - 2); c++)
  15.          printf(" ");
  16.  
  17.       for (c = 0 ; c <= i; c++)
  18.          printf("%ld ",fact(i)/(fact(c)*fact(i-c)));
  19.  
  20.       printf("\n");
  21.    }
  22.  
  23.    return 0;
  24. }
  25.  
  26. long fact(int n)
  27. {
  28.    int c;
  29.    long result = 1;
  30.  
  31.    for (c = 1; c <= n; c++)
  32.          result = result*c;
  33.  
  34.    return result;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement