vin
New Coder
// Online C compiler to run C program online
#include <stdio.h>
void sum(int x,int y)
{
int add=x+y;
printf("%d",add);
}
void subtract(int x,int y)
{
int sub=x-y;
printf("%d",sub);
}
void product(int x,int y)
{
int pro=x*y;
printf("%d",pro);
}
void division(int x,int y)
{
int div=x/y;
printf("%d",div);
}
int main() {
int x,y;
char c;
printf("type 2 num\n");
scanf("%d%d",&x,&y);
printf("press + for sum,-for sub,*for prod,/ for div\n");
scanf("%c",&c);
switch (c)
{
case '+':
sum(x,y);
break;
case '-':
subtract(x,y);
break;
case '*':
product(x,y);
break;
case '/':
division(x,y);
break;
default:
printf("NONE");
break;
}
}
#include <stdio.h>
void sum(int x,int y)
{
int add=x+y;
printf("%d",add);
}
void subtract(int x,int y)
{
int sub=x-y;
printf("%d",sub);
}
void product(int x,int y)
{
int pro=x*y;
printf("%d",pro);
}
void division(int x,int y)
{
int div=x/y;
printf("%d",div);
}
int main() {
int x,y;
char c;
printf("type 2 num\n");
scanf("%d%d",&x,&y);
printf("press + for sum,-for sub,*for prod,/ for div\n");
scanf("%c",&c);
switch (c)
{
case '+':
sum(x,y);
break;
case '-':
subtract(x,y);
break;
case '*':
product(x,y);
break;
case '/':
division(x,y);
break;
default:
printf("NONE");
break;
}
}