-
Notifications
You must be signed in to change notification settings - Fork 0
/
DMAS by If Else Condition
42 lines (25 loc) · 1.37 KB
/
DMAS by If Else Condition
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<iostream> //standard i/o header file
#include<cmath> // This body is use if we perform any mathematics operations
using namespace std;
int main()
{
float a,b; //initilization float
cout<<"ENter any two number "<<endl; //shows output to take numbers from user
cin>>a>>b; //take user input
char op; //initilization char
cout<<"Enter Operation (+,-,*,/,sqrt)"<<endl; //shows output to take operation from user on screen
cin>>op; //take user input
if (op=='+') //This operation will perform addition of two numbers
cout<<"Addision of two number is = " <<a+b<<endl;
else if (op=='-') // This Operation will perform subtraction of two numbers
cout<<"Subtraction of number is = " <<a-b<<endl;
else if (op=='*') //This Operation will perform multiplication of two number
cout<<"Multiplication of number is = " <<a*b<<endl;
else if (op=='/') //This operation will perform division of two numbers
cout<<"Division of number is = " <<a/b<<endl;
else if (sqrt(a)) // This operation will perform sqrt of numbers
cout<<"Square root of a is = "<<sqrt(a)<<endl;
else // if the operation are not of them then it will show wrong operation
cout<<"wrong operator";
return 0;
}