Advertisement
Niloy007

Last class code!

Jul 29th, 2020
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.69 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main() {
  4.     int n;
  5.     scanf("%d", &n);
  6.     int i, j;
  7.     for (j = 1; j <= n; j++) {
  8.         int c = 1;   // 1st number;
  9.         for (i = 1; i <= j; i++) {
  10.             printf("%d ", c);   // c = 1
  11.             c = c * (j - i) / i; // c = 1 * (3 - 1) / 1 = 2
  12.         }
  13.         printf("\n");
  14.     }
  15. }
  16. /*
  17.          1
  18.        1  1
  19.       1  2  1
  20.  
  21. */
  22.  
  23.  
  24.  
  25.  
  26.  
  27. // void oddPrint(int lowerLimit, int upperLimit) {
  28.  
  29. //  // Best Case
  30. //  if(lowerLimit > upperLimit) {
  31. //      return;
  32. //  }
  33.  
  34. //  printf("%d ", lowerLimit);
  35.  
  36. //  oddPrint(lowerLimit + 2, upperLimit);  
  37. // }
  38.  
  39. // int main() {
  40. //  int lowerLimit, upperLimit;
  41. //  scanf("%d %d", &lowerLimit, &upperLimit);
  42.  
  43. //  oddPrint(lowerLimit, upperLimit);
  44. //  printf("\n");
  45. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement