Program # 18: Program to solve Arithmatic operation
//Program to solve arithmetic operation(Level - Low)
#include <iostream.h> #include <conio.h>
void main ()
{
clrscr(); int a,b,res;
char z;
char z;
cout<<"Enter the value of a = "; cin >>a;
cout<<"Enter the value
of b = "; cin >>b;
cout<<"Enter the arithmetic operator like (+,−,* and /) = ";
cin >>z;
cin >>z;
switch (z)
{
case '+':
res = a+b;break;
case '−':
res = a−b;
break;
case '*':
res = a*b;
break;
case '/':
res = a/b;
break;
res = a+b;break;
case '−':
res = a−b;
break;
case '*':
res = a*b;
break;
case '/':
res = a/b;
break;
default: cout<<"You do not press any operator ";
}
cout<<"The result is =
"<<res<<endl;
getch ();
getch ();
}
0 Comments