Abs() - C library function Program
Declaration :
|
1 |
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.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#include <stdio.h> #include <stdlib.h> int main () { int a, b; a = abs(5); printf("value of a = %dn", a); b = abs(-10); printf("value of b = %dn", b); return(0); } |
