C examples for stdlib.h:abs
function
<cstdlib> <stdlib.h>
Returns the absolute value of parameter n (|n|).
long long int abs (long long int n); int abs (int n); long int abs (long int n);
Parameter | Description |
---|---|
n | Integral value. |
The absolute value of n.
#include <stdio.h> #include <stdlib.h> int main ()//w w w . j a va2 s .co m { printf ("%d\n", abs(23)); printf ("%d\n",abs(-11)); printf ("%d\n", abs(0)); printf ("%d\n",abs(-1)); return 0; }