-
Notifications
You must be signed in to change notification settings - Fork 0
/
subtract_of_numbers.c
46 lines (42 loc) · 968 Bytes
/
subtract_of_numbers.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
void subtractNumbers()
{
char charInput;
int n, sub = 0, temp;
system("cls");
printf("************* Subtract Numbers *************\n");
printf("How many numbers you want to subtract: ");
scanf("%d", &n);
printf("Enter %d number using space: ", n);
scanf("%d", &sub);
for (int i = 1; i < n; i++)
{
scanf("%d", &temp);
sub -= temp;
}
printf("subtract of the numbers is : %d\n", sub);
printf("Command > ");
takeCharInputAgain:
fflush(stdin);
scanf("%c", &charInput);
if (charInput == 'M' || charInput == 'm')
{
mainMenu();
}
else if (charInput == 'A' || charInput == 'a')
{
subtractNumbers();
}
else if (charInput == 'B' || charInput == 'b')
{
calculation();
}
else if (charInput == 'E' || charInput == 'e')
{
exit(0);
}
else
{
printf("Wrong command >");
goto takeCharInputAgain;
}
}