Skip to content

Commit 9a2c2ef

Browse files
pyramid of *
program to make Full Pyramid of *
1 parent c5c05c2 commit 9a2c2ef

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pyramid of *

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <stdio.h>
2+
int main() {
3+
int i, space, rows, k = 0;
4+
printf("Enter the number of rows: ");
5+
scanf("%d", &rows);
6+
for (i = 1; i <= rows; ++i, k = 0) {
7+
for (space = 1; space <= rows - i; ++space) {
8+
printf(" ");
9+
}
10+
while (k != 2 * i - 1) {
11+
printf("* ");
12+
++k;
13+
}
14+
printf("\n");
15+
}
16+
return 0;
17+
}

0 commit comments

Comments
 (0)