Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
1st Parameter
The number from which to get absolute value
Read more about parameters of abs in parameters section
The absfunction in C language Computes the absolute value of an integer.
The abs function computes the absolute value of an integer number. It returns the non-negative value of an integer. For positive numbers and zero, it returns the same number. For negative numbers, it returns the negation of that number. This function is commonly used when the magnitude of a number is needed, regardless of its sign.
The absfunction takes 1
parameter:
•
int `n`: The number from which to get absolute value
The abs function return value :
Returns the absolute value of the input integer
The returned value is always non-negative
Output
This example demonstrates the basic usage of the `abs` function with positive, negative, and zero values.