Skip to content

Commit 0336e1e

Browse files
authored
Create Reverse Star Pattern.c
1 parent f125d72 commit 0336e1e

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* You're given a number N. Print the first N lines of the below-given pattern.
2+
3+
*
4+
**
5+
***
6+
****
7+
*****
8+
Input:
9+
First-line will contain the number N.
10+
Output:
11+
Print the first N lines of the given pattern.
12+
13+
Constraints
14+
1≤N≤200
15+
Sample Input 1:
16+
4
17+
Sample Output 1:
18+
*
19+
**
20+
***
21+
****
22+
Sample Input 2:
23+
2
24+
Sample Output 2:
25+
*
26+
**
27+
EXPLANATION:
28+
In the first example, we'll print the first 4 lines of the given pattern.
29+
In the second example, we'll print the first 2 lines of the given pattern */
30+
31+
32+
#include <stdio.h>
33+
34+
int main(void) {
35+
36+
int t;
37+
scanf("%d",&t);
38+
39+
for(int i=1;i<=t;i++)
40+
{
41+
for(int j=t;j>i;j--)
42+
printf(" ");
43+
for(int k=1;k<=i;k++)
44+
printf("*");
45+
printf("\n");
46+
}
47+
48+
49+
return 0;
50+
}

0 commit comments

Comments
 (0)