-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
41 lines (40 loc) · 934 Bytes
/
main.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
#include <stdio.h>
int main(void)
{
int n, m, i;
float a, b, c;
printf("計算回数は\n");
scanf("%d", &m);
for (i = 0; i < m; i++)
{
printf("1=足し算\n2=引き算\n3=掛け算\n4=割り算\n計算方法は");
scanf("%d\n", &n);
switch (n)
{
case 1:
scanf("%f\n", &a);
scanf("%f\n", &b);
c = a + b;
printf("%f\n", c);
break;
case 2:
scanf("%f\n", &a);
scanf("%f\n", &b);
c = a - b;
printf("%f\n", c);
break;
case 3:
scanf("%f\n", &a);
scanf("%f\n", &b);
c = a * b;
printf("%f\n", c);
break;
case 4:
scanf("%f\n", &a);
scanf("%f\n", &b);
c = a / b;
printf("%f\n", c);
break;
}
}
}