round() function

The round() function returns the integer value that is nearest to the argument, with halfway cases rounded away from zero.

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;

    cout << round(x);

    return 0;
}


No comments:

Post a Comment