Commit fc4dfadf by ilahma

Delete switch.c

parent cf28f9af
Showing with 0 additions and 74 deletions
#include <stdio.h>
int add(int a,int b);
int subtract(int a,int b);
int multiplication(int a,int b);
int division(int a,int b);
int main () {
int a;
int b;
char operator;
printf("Enter two numbers:\n");
scanf("%d %d",&a, &b);
printf("Please, enter an operator: +,-,*,: \n");
scanf(" %c", &operator);
switch(operator)
{
case '+':
printf("%d + %d = %d",a,b,add(a,b));
break;
case '-':
printf("%d - %d = %d",a,b,subtract(a,b));
break;
case '*':
printf("%d * %d = %d",a,b,multiplication(a,b));
break;
case '/':
printf("%d / %d = %d",a,b,division(a,b));
break;
default:
printf("Operator is not correct");
}
return 0;
}
int add(int a,int b)
{
return a+b;
}
int subtract(int a,int b)
{
return a-b;
}
int multiplication(int a,int b)
{
return a*b;
}
int division(int a,int b)
{
return a/b;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment