Skip to content

Commit 4438b80

Browse files
committed
Create inverted_star_triangle.c
1 parent 63fb71a commit 4438b80

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

inverted_star_triangle.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Problem Statement: Write a C program to print an inverted triangle of
3+
asterisks (*) that starts with n stars and decreases by one each row.
4+
*/
5+
6+
#include<stdio.h>
7+
8+
int main() {
9+
int i, j, n;
10+
11+
i = n;
12+
13+
printf("Enter the value for n: ");
14+
scanf("%d", &n);
15+
16+
for ( i = 1; i <= n; i++)
17+
{
18+
for ( j = n; j >= i; j--)
19+
printf(" * ");
20+
21+
printf("\n");
22+
}
23+
return 0;
24+
}

0 commit comments

Comments
 (0)