Labs () function in C
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
4 ★ | 1 Vote
You should read it
May be interested
- MIN function in SQL Serverthe article will explore and show you how to use the min function in sql server to find the smallest value in a set.
- MAX function in SQL Serverthe article will explore and show you how to use the max function in sql server to find the maximum value in a set.
- Gmail labs: increase functionality for Gmailgmail is the most popular webmail service of google thanks to support for many features such as pop3, imap mail checking, simple and easy-to-use interface.
- SUM function in SQL Serverthe sql server sum function returns the total value of a column, a data set, or an expression.
- The ord () function in Pythonthe built-in ord () function in python returns an integer representing the unicode code of the specified character.
- RIGHT function in SQL Serverthe article will explore and guide you how to use the right function in sql server to extract some characters from the right side of a given string.
- Int () function in Pythonthe int () function in python returns an integer object from any number or string.
- AVG function in SQL Serverthe avg function in sql server returns the average value of an expression or average value according to the specified column of the selected row.
- Hex () function in Pythonthe hex () function is one of python's built-in functions, used to convert an integer into the corresponding hexadecimal form.
- ABS function in SQL Serverthis article will show you in detail how to use the abs () handling function in sql server with specific syntax and examples to better visualize and capture functions.