#include<stdio.h>
int add(int x, int y );
int sub(int a, int b );
int mult(int d, int e);
int div(int g, int h);
int main(){
int num1, num2, choice;
printf("[0] Exit\n[1] Addition\n[2] Subtraction\n[3] Multiplication\n[4] Division\n");
scanf("%d", &choice);
switch(choice){
case 0:
exit(0);
case 1:
printf("Enter 1st number:");
scanf("%d", &num1);
printf("\nEnter 2nd number:");
scanf("%d", &num2);
printf("\nThe addition is:%d\n", add( num1,num2));
break;
case 2:
printf("Enter 1st number:");
scanf("%d", &num1);
printf("\nEnter 2nd number:");
scanf("%d", &num2);
printf("\nThe subtraction is:%d\n", sub(num1,num2));
break;
case 3:
printf("Enter 1st number:");
scanf("%d", &num1);
printf("\nEnter 2nd number:");
scanf("%d", &num2);
printf("\nThe multiplication is:%d\n", mult(num1,num2));
break;
case 4:
printf("Enter 1st number:");
scanf("%d", &num1);
printf("\nEnter 2nd number:");
scanf("%d", &num2);
printf("\nThe division is:%d\n", div(num1,num2));
break;
default:
printf("\nInvalid choice!!!!!!!\n");
break;
}
}
int add(int x,int y){
int z;
z = x + y;
return z;
}
int sub(int a,int b){
int c;
c = a - b;
return c;
}
int mult(int d,int e){
int f;
f = d * e;
return f;
}
int div(int g,int h){
int i;
i = g / h;
return i;
}
No comments:
Post a Comment