Write a program to add, subtract, multiply and divide two numbers, accepted from user switch case.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,ch,add,sub,mul,div;
clrscr();
printf("\n1 for addition \n2 for substraction");
printf("\n3 for multiplication \n4 for division");
printf("\nEnter two numbers:");
scanf("%d%d",&a,&b);
printf("\nEnter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1:
add=a+b;
printf("Addition of a & b=%d",add);
break;
case 2:
sub=a-b;
printf("Substraction of a & b=%d",sub);
break;
case 3:
mul=a*b;
printf("Multiplication of two numbers=%d",mul);
break;
case 4:
div=a/b;
printf("Division of two numbers=%d",div);
break;
default:
printf("Invalid choice....");
}
getch();
}