PROGRAM:
#include<stdio.h>main()
{
int a,b;
char op;
printf("enter the values of a,b");
scanf("%d%d",&a,&b);
printf("enter arithematic operator");
scanf("%c",&op);
switch(op)
{
case '+':printf("a+b=%d",a+b);
break;
case '-':printf("a-b+=%d",a-b);
break;
case '*':printf("a*b=%d",a*b);
break;
case '/':printf("a/b=%d",a/b);
break;
default :printf("unknown arithematic operator");
}
OUTPUT:
enter the values of a,b
1,2
enter arithematic operator
'+'
1+2=3.
No comments:
Post a Comment