imaxabs() in C++

imaxabs(): This function is available in the file inttypes.h. This function computes the absolute value of the given number. It takes one argument in the type of intmax_t and returns the absolute value of it. It returns the value of type intmax_t.

Parameters: One parameter is required for this function.

j: The value whose absolute value is to be determined. The type of argument is intmax_t.

Syntax:

imaxabs(j)

For Example:

imaxabs(-10) = > It returns 10.

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    intmax_t j = -10;
    cout << imaxabs(j<< "\n";

    return 0;
}


No comments:

Post a Comment