C examples for math.h:abs
function
<cmath> <ctgmath> <math.h>
Compute absolute value, Returns the absolute value of x: |x|.
long double abs (long double x); double abs (double x); float abs (float x); double abs (T x);
Parameter | Description |
---|---|
x | Value whose absolute value is returned. |
The absolute value of x.
#include <iostream> // std::cout #include <cmath> // std::abs int main ()/* w w w .jav a 2s . c o m*/ { std::cout << "abs (3.1416) = " << std::abs (3.1416) << '\n'; std::cout << "abs (-10.6) = " << std::abs (-10.6) << '\n'; return 0; }