llround() function

The llround() function returns the integer value that is nearest to x, with halfway cases rounded away from zero. The value returned is of type long long int.

For Example: 

1. 13.56 = 14 Up Round

2. 13.46 = 13 Down Round

Example:

Input:  x = 13.56
Output: 14

Approach

C++

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

int main()

{
    double x = 13.56;

    long long int ans = llround(x);

    cout << ans << "\n";

    return 0;
}


No comments:

Post a Comment