-
Notifications
You must be signed in to change notification settings - Fork 0
/
mystar.c
49 lines (48 loc) · 898 Bytes
/
mystar.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
void reverseStarPrint(int rows)
{
for (int i = 0; i <= rows; i++)
{
for (int j = 0; j < i; j++)
{
printf("*");
}
printf("\n");
}
}
void starPrint(int rows)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j <= rows - i - 1; j++)
{
printf("*");
}
printf("\n");
}
}
void main()
{
int rows, type;
printf("How many Rows You Want : ");
scanf("%d", &rows);
printf("0 For Star Print and 1 For Reverse Star Print : ");
scanf("%d", &type);
if (type > 1)
{
goto end;
}
switch (type)
{
case 0:
starPrint(rows);
break;
case 1:
reverseStarPrint(rows);
break;
default:
break;
}
end:
printf("You Entered Wrong Choice!");
}