Source code
#include <iostream>
using namespace std;
int round_Num(int num)
{
int x = (num / 10) * 10;
int y = x + 10;
return (num - x > y - num)? y : x;
}
int main()
{
int num;
cout<<"\nEnter a number (between 1 and 1000000) : ";
cin>>num;
cout << round_Num(num) << endl;
return 0;
}
Output
Comments
Leave a comment