-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsquare_of_a_number.c
More file actions
42 lines (36 loc) · 836 Bytes
/
square_of_a_number.c
File metadata and controls
42 lines (36 loc) · 836 Bytes
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
void squareANumber()
{
char charInput;
int n, square = 0;
system("cls");
printf("************* Square of A Number *************\n");
printf("Enter the number: ");
scanf("%d", &n);
square = n * n;
printf("Square of %d is : %d\n", n, square);
printf("Command > ");
takeCharInputAgain:
fflush(stdin);
scanf("%c", &charInput);
if (charInput == 'M' || charInput == 'm')
{
mainMenu();
}
else if (charInput == 'A' || charInput == 'a')
{
squareANumber();
}
else if (charInput == 'B' || charInput == 'b')
{
calculation();
}
else if (charInput == 'E' || charInput == 'e')
{
exit(0);
}
else
{
printf("Wrong command >");
goto takeCharInputAgain;
}
}