Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double x;
- cin >> x;
- if(x == 0.0) {
- cout << "0 0 0";
- }
- else {
- int floor = int(x);
- double decimal = x - double(floor);
- cout << floor << " ";
- //Integer number
- if(x == double(floor))
- cout << floor << " ";
- else
- cout << floor+1 << " ";
- //Rounding
- if (decimal >= 0.5)
- cout << floor +1;
- else
- cout << floor;
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement