Home » C++ Math lrint() Function

C++ Math lrint() Function

by Online Tutorials Library

C++ Math lrint()

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

Syntax

Suppose a number is ‘x’. Syntax would be:

Parameter

x: The value that can be float, double or long double.

Return value

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

Example 1

Let’s see a simple example.

Output:

Enter the value which you want to round : 7.8  Name of the methods are : 1. Rounding downwards 2. Rounding upwards 3. Rounding towards zero 4. Rounding to the nearest Enter the number of rounding method : 1  Rounding downwards,value is :7 

Next TopicC++ Math Functions

You may also like