Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 745 Bytes

251_abs.asciidoc

File metadata and controls

49 lines (35 loc) · 745 Bytes

abs

NAME

abs - computes the absolute value of an integer.

SYNOPSIS
#include <math.h>

int abs(int j);
DESCRIPTION

The abs() function computes the absolute value of the integer argument j.

SEE ALSO

fabs, labs

EXAMPLE
link:src/abs.c[role=include]
OUTPUT
$ gcc -Wall abs.c
$ ./a.out 2147483647
Number out of range.
$ ./a.out 2147483646
The number you entered 2147483646.
The absolute value is 2147483646.
$ ./a.out -2147483647
The number you entered -2147483647.
The absolute value is 2147483647.
$ ./a.out -2147483648
Number out of range.