Abs() - C library function Program

Declaration :

int abs(int x)

Explanation :

PurposeThe C library function int abs(int x) returns the absolute value of int x.
Parameters x ===> This is the integral value.
Return ValueThis function returns the absolute value of x.
Header Filemath.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);
}