#include <stdio.h>
#pragma warning(disable:4996)
int add(int x, int y)
{
return x + y;
}
int sub(int x, int y)
{
return x - y;
}
int mult(int x, int y)
{
return x*y;
}
int div(int x, int y)
{
return x / y;
}
int rem(int x, int y)
{
return x % y;
}
int main()
{
int a, b, c;
do {
printf("유형: ");
scanf("%d", &c);
printf("숫자 두개: ");
scanf("%d%d", &a, &b);
if (a != 0 && b != 0 && c != 0)
{
switch (c)
{
case 1: printf("Result: %d\n\n", add(a, b)); break;
case 2: printf("Result: %d\n\n", sub(a, b)); break;
case 3: printf("Result: %d\n\n", mult(a, b)); break;
case 4: printf("Result: %d\n\n", div(a, b)); break;
default: printf("Result: %d\n\n", rem(a, b)); break;
}
}
} while (a != 0 && b != 0 && c != 0);
}