Labs () function in C
Function long int labs (long int x) returns the absolute value of x.
Labs () function in C
Function long int labs (long int x) returns the absolute value of x.
Declare labs () function in C
Below is the declaration for labs () in C:
long int labs ( long int x )
Parameters
x: an integer value.
Returns the value
This function returns the absolute value of x.
For example
The following C program illustrates the usage of labs () in C:
#include #include int main () { long int a , b ; a = labs ( 65987L ); printf ( "Gia tri cua a = %ldn" , a ); b = labs (- 1005090L ); printf ( "Gia tri cua b = %ldn" , b ); return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous lesson: Div () function in C
Next lesson: The function ldiv () in C
You've just finished reading the article "Labs () function in C" edited by the TipsMake team. You can save labs-function-in-c.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.
- Harness the Power of AlphaCell Labs to Transform Healthcare
- 10 interesting applications from Google Labs
- 10 interesting add-ons on Gmail Labs
- The 5 best and worst features of Gmail Labs
- Why Topaz Labs AI has the best AI photo and video editing tool?
- Save time with these text formatting functions in Microsoft Excel