labs | function |
long int labs ( long int n ); |
<cstdlib> |
Absolute value
Returns the absolute value of parameter n ( /n/ ).
Parameters
- n
- Integral value.
Return Value
The absolute value of n.Example
/* labs example */ #include <stdio.h> #include <stdlib.h> int main () { long int n,m; n=labs(65537L); m=labs(-100000L); printf ("n=%ld\n",n); printf ("m=%ld\n",m); return 0; } |
Output:
n=65537 |
See also
abs | Absolute value (function) |
fabs | Compute absolute value (function) |
ldiv | Integral division (function) |