Program to solve arithmetic operation(Level - Low)

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;

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;

switch (z)
{
case '+': 
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 ();
}

Post a Comment

0 Comments