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