Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #define F 31
  3.  
  4. static int
  5. factorial (int n)
  6. {
  7.   return (n < 2) ? 1 : n * factorial (n - 1);
  8. }
  9.  
  10.  
  11. int main()
  12. {
  13.     int N, b;
  14.     long int x;
  15.     int a[F] = {0};
  16.     scanf("%d", &N);
  17.     b = N;
  18.  
  19.     for(int n = 0; b >= n; ++n){
  20.         x = factorial(b)/(factorial(n)*factorial(b-n));
  21.         a[n] = x;
  22.     }
  23.  
  24.     for(int i = 0; i < F; i++){
  25.         if (a[i]){
  26.             printf("%d ", a[i]);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement