Skip to content

Commit 260209d

Browse files
committed
Create star_hash_pattern.c
1 parent 154901a commit 260209d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

star_hash_pattern.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Create a C program that prints a triangle of asterisks followed
3+
by a hash # on each line, increasing by row.
4+
*/
5+
6+
#include <stdio.h>
7+
8+
int main()
9+
{
10+
int i, j, n;
11+
12+
printf("Enter the value for N: ");
13+
scanf("%d", &n);
14+
15+
i = n;
16+
17+
for (i = 0; i <= n; i++)
18+
{
19+
for (j = 1; j <= i; j++)
20+
printf(" * ");
21+
22+
printf(" # \n");
23+
}
24+
return 0;
25+
}

0 commit comments

Comments
 (0)