_Jenny

auto code

Aug 26th, 2023 (edited)
64
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | Source Code | 0 0
  1. #include <stdio.h>
  2. int main() {
  3.    int rows, coef = 1, space, i, j;
  4.    printf("Enter the number of rows: ");
  5.    scanf("%d", &rows);
  6.    for (i = 0; i < rows; i++) {
  7.       for (space = 1; space <= rows - i; space++)
  8.          printf(" ");
  9.       for (j = 0; j <= i; j++) {
  10.          if (j == 0 || i == 0)
  11.             coef = 1;
  12.          else
  13.             coef = coef * (i - j + 1) / j;
  14.          printf(" %d", coef);
  15.       }
  16.       printf("\n");
  17.    }
  18.    return 0;
  19. }
  20.  
Advertisement
Comments
  • _Jenny
    2 years
    Comment was deleted
Add Comment
Please, Sign In to add comment