-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath.cpp
More file actions
41 lines (31 loc) · 1.12 KB
/
Copy pathmath.cpp
File metadata and controls
41 lines (31 loc) · 1.12 KB
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
#include <iostream>
#include <cmath>
using namespace std;
int main () {
//Max and min
//The max(x,y) function can be used to find the highest value of x and y:
cout << min(1,100) << " is min value and min indicates smaller value" << endl;
cout << max(1,100) << " is max value and max indicates greater value" << endl;
int x,y;
cout << "enter first number : " ;
cin >> x ;
cout << "enter second number : " ;
cin >> y ;
cout << min(x,y) << " is smaller than " << max(x,y) << endl << " or " << endl << max(x,y) << " is greater than " << min(x,y) <<endl;
//cmath lib
//sqrt(x) for square root of x
int sq ;
cout << "enter a number to get it square root : ";
cin >> sq ;
cout << sqrt(sq) << endl;
//round(fl) fl is float or decimal value
float fl;
cout << "enter a decimal value to get it roundup value : "; //roundup or nearest value
cin >> fl ;
cout << round(fl) << endl;
//log(ln) , used to get logorithm value
float ln;
cout << "enter a number to get it\'s logorithm value : ";
cin >> ln ;
cout << log(ln) << endl;
}