C++ Math llrint()

The function rounds off the given value using current rounding mode and returns the value of type long long int.

Syntax

Suppose a number is 'x'. Syntax would be:

Parameter

x: The value which is to be rounded.

Return value

It returns the rounded value of 'x' and the return type of the value is long long int.

Example 1

Let's see a simple example when the rounding direction is upwards.

Output:

Value of x is :5.3
Rounded value of x is :6   

Example 2

Let's see a simple example when the rounding direction is downwards.

Output:

Value of x is :7.9
Rounded value of x is :7





Latest Courses