C++ program to demonstrate the use of math library functions
kw.cpp
Output
kodingwindow@kw:~$ g++ kw.cpp
kodingwindow@kw:~$ ./a.out ——————————————————————————————————————————— Program to use the math library functions ——————————————————————————————————————————— fabs (3.9) | 3.9 ceil (3.9) | 4 floor(3.9) | 3 e^0 | 1 pow(0,0) | 1 log(2)Natural | 0.693147 log10(2) | 0.30103 sqrt(20) | 4.47214 sin(90)radian | 0.893997 cos(90) | -0.448074 tan(90) | -1.9952 ——————————————————————————————————————————— kodingwindow@kw:~$
C++ program to demonstrate the use of math constants
kw.cpp
Output
kodingwindow@kw:~$ g++ kw.cpp
kodingwindow@kw:~$ ./a.out ——————————————————————————————————————————— Program to use the math library functions ——————————————————————————————————————————— Value of PI | 3.14159 Value of PI/2 | 1.5708 Value of PI/4 | 0.785398 Value of 1/PI | 0.31831 Value of 2/PI | 0.63662 Value of log2e | 1.4427 Value of log10e | 0.434294 Value of Nlog2 | 0.693147 Value of Nlog10 | 2.30259 Value of sqrt(1/2) | 1.41421 Value of 1/sqrt(2) | 0.707107 Value of 2/sqrt(PI) | 1.12838 Positive Infinity | inf ——————————————————————————————————————————— kodingwindow@kw:~$
Advertisement