The llabs()
function in C++ returns the absolute value of a long, long int data.
It is similar to the abs()
and labs()
functions except for the type of parameters.
#include<cstdlib>
long long int llabs(long long int n)
n
- represents the value whose absolute value is to be foundIt returns the absolute value.
Input:
n = -1234567890987654321
Function call:
llabs(n);
Output:
1234567890987654321
#include <iostream>#include <cstdlib>using namespace std;int main(){long long x,y;x = -1234567890987654321;y = 1234567890987654321;cout << "llabs(" << x << ") = " << llabs(x) << endl;cout << "llabs(" << y << ") = " << llabs(y) << endl;return 0;}
Free Resources