/*W.A.P TO PRFORM ARITHMETIC CALCULATION.THIS PROGRAM
INPUTS TWO OPERANDS AND AN OPERATOR AND THEN DISPLAYS THE
CALCULATED RESULT.*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float op1,op2,res;
char ch;
cout<<"\nEnter two numbers";
cin>>op1>>op2;
cout<<"\nEnter an operator(+,-,*,/,%):";
cin>>ch;
cout<<"\n";
switch(ch)
{
	case '+' : res=op1+op2;
		   break;
	case '-' : res=op1-op2;
		   break;
	case '*' : res=op1*op2;
		   break;
	case '/' : if(op2==0)
			cout<<"Divide by zero error !!!";
		   else
			res=op2/op1;
		   break;
	case '%' : if(op2==0)
			cout<<"Divide by zero error !!!";
		   else
		   {
			int r,q;
			q=op2/op1;
			r=op2-(q*op1);
			res=r;
		   }
		   break;
	default: cout<<"\n Wrong Operator !!!";
}
cout<<"The calculated result is :"<<res<<"\n";
getch();
}