Visit this website and learn Php java and Many more
programmersbhawa.comFriends, my today's program is that we will take two numbers from the keyboard and addition,substraction,multiply and Divide it will only part in the same program with the help of switch case.
#include(stdio.h)
#include(conio.h)
main()
{
int n,rem,a,b;
char op;
clrscr();
printf("Enter Operator(+,-,*,/)...");
scanf("%c",&op);
printf("Enter numbers...");
scanf("%d%d",&a,&b);
switch(op)
{
case '+' :
printf("Result : %d ",a+b);
break;
case '-' :
printf("Result : %d ",a-b);
break;
case '*' :
printf("Result : %d ",a*b);
break;
case '/' :
printf("Result : %d ",a/b);break;
default :
printf("Invalid operator....");
}
getch();
}

No comments:
Post a Comment