Abs() - C library function Program
Declaration :
int abs(int x)
Explanation :
| Purpose | The C library function int abs(int x) returns the absolute value of int x. |
| Parameters | x ===> This is the integral value. |
| Return Value | This function returns the absolute value of x. |
| Header File | math.h |
| Exception |
C Program : Example
The following example shows the usage of abs() function.
#include#include int main () { int a, b; a = abs(5); printf("value of a = %d\n", a); b = abs(-10); printf("value of b = %d\n", b); return(0); }
