Skip to content

Commit 3ce9fa8

Browse files
authored
pyramid using star
Program to print Pyramid Pattern
1 parent c5c05c2 commit 3ce9fa8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: pryamid using *

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include<stdio.h>
2+
int main() {
3+
int r, s, rows=0;
4+
int t=0;
5+
clrscr();
6+
printf("Enter number of rows to print the pyramid: ");
7+
scanf("%d", &rows);
8+
printf("\n");
9+
printf("The Pyramid Pattern for the number of rows are:");
10+
printf("\n\n");
11+
for(r=1;r<=rows;++r,t=0) {
12+
for(s=1; s<=rows-r; ++s){
13+
printf(" ");
14+
}
15+
while (t!=2*r-1) {
16+
printf("* ");
17+
++t;
18+
}
19+
printf("\n");
20+
}
21+
getch();
22+
return 0;
23+
}

0 commit comments

Comments
 (0)