how to round to nearest whole number unity
#include <iostream>
#include <cmath>
int main() {
double inputNumber;
int roundedNumber;
// Step 1: Input a decimal number
std::cout << "Enter a decimal number: ";
std::cin >> inputNumber;
// Step 2: Round the decimal number to the nearest whole number using the round function from cmath
roundedNumber = static_cast<int>(std::round(inputNumber));
// Step 3: Display the rounded whole number
std::cout << "Rounded to the nearest whole number: " << roundedNumber << std::endl;
return 0;
}