#include<stdio.h>
#include<conio.h>
void main()
{
char op;
int a, b;
printf("enter an Operator = ");
scanf("%c",&op);
printf("enter first number in = ");
scanf("%d",&a);
printf("enter second number in = ");
scanf("%d",&b);
switch(op)
{
case '+':
printf("Result is = %d\n", a+b);
break;
case '-':
printf("Result is = %d\n", a-b);
break;
case '*':
printf("Result is = %d\n", a*b);
break;
case '/':
printf("Result is = %d\n", a%b);
break;
default:
printf("Oops TRY AGAIN!!!");
}
getch();
}
Output:
Click Here to Switch statement
Click here to All Important Questions with Answers.
Click Here to All C Program.
No comments:
Post a Comment