-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpattern1.c
44 lines (42 loc) · 858 Bytes
/
pattern1.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
void pattern1()
{
char charInput;
int i, j, n;
system("cls");
printf("************* Pattern 1 *************\n");
printf("Enter the number of row: ");
scanf("%d", &n);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; j++)
{
printf("* ");
}
printf("\n");
}
printf("Command > ");
takeCharInputAgain:
fflush(stdin);
scanf("%c", &charInput);
if (charInput == 'M' || charInput == 'm')
{
mainMenu();
}
else if (charInput == 'A' || charInput == 'a')
{
pattern1();
}
else if (charInput == 'B' || charInput == 'b')
{
patternPrinting();
}
else if (charInput == 'E' || charInput == 'e')
{
exit(0);
}
else
{
printf("Wrong command >");
goto takeCharInputAgain;
}
}