mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-23 15:48:42 +00:00
52 lines
829 B
C
52 lines
829 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int x, a, b, c;
|
|
|
|
scanf("%d%d%d%d", &x, &a, &b, &c);
|
|
|
|
switch (x) {
|
|
case 0:
|
|
printf("%d", a + b);
|
|
break;
|
|
|
|
case 1:
|
|
printf("%d", a - b);
|
|
break;
|
|
|
|
case 2:
|
|
printf("%d", a * b);
|
|
break;
|
|
|
|
case 3:
|
|
printf("%d", a / b);
|
|
break;
|
|
|
|
case 4:
|
|
printf("%d", a % b);
|
|
break;
|
|
|
|
case 5:
|
|
printf("%d", a ? b : c);
|
|
break;
|
|
|
|
case 6:
|
|
printf("%d", a > b);
|
|
break;
|
|
|
|
case 7:
|
|
printf("%d", a < b);
|
|
break;
|
|
|
|
case 8:
|
|
printf("%d", a != b);
|
|
break;
|
|
|
|
case 9:
|
|
printf("%d", a == b);
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|