Diwali Dhamaka Deal On Amazon
// program to perform arithmetic calculations on integer.
Find Out the Result
1. main()
{
int x,y,z;
x=8++;
y=++x++;
z=(x+y)--;
printf("x =%d, y= %d, z=%d, x,y);
}
// program to perform arithmetic calculations on integer.
#include<stdio.h>
void main()
{
char op;
int a,b;
printf("Enter number operator and arithmetic number");
scanf("%d%c%d",&a,&op,&b);
switch(op)
{
case '+':
printf("Result=%d\n",a+b);
break;
case '-'
printf("Result=%d\n",a-b);
break;
case '*'
printf("Result=%d\n",a*b);
break;
case '/'
printf("Result=%d\n",a/b);
break;
case '%'
printf("Result=%d\n",a%b);
break;
default:
printf("Enter Valid operator\n");
break;
} // end of switch
} // end of main
No comments:
Post a Comment