1#include <stdio.h>
2int main() {
3 int rows, i, j, space;
4 printf("Enter the number of rows: ");
5 scanf("%d", &rows);
6 for (i = rows; i >= 1; --i) {
7 for (space = 0; space < rows - i; ++space)
8 printf(" ");
9 for (j = i; j <= 2 * i - 1; ++j)
10 printf("* ");
11 for (j = 0; j < i - 1; ++j)
12 printf("* ");
13 printf("\n");
14 }
15 return 0;
16}
17
1#include <stdio.h>
2int 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("%4d", coef);
15 }
16 printf("\n");
17 }
18 return 0;
19}
20