Program to sovle basic mathematical operation
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
//Program to sovle basic mathematical operation
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 operation you want to perform like (+,-,*,/)";
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<<"please press any operator";
}
cout<<"The result is ="<<res;
getch();
return 0;
}
#include <conio.h>
using namespace std;
int main()
{
//Program to sovle basic mathematical operation
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 operation you want to perform like (+,-,*,/)";
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<<"please press any operator";
}
cout<<"The result is ="<<res;
getch();
return 0;
}
Comments
Post a Comment