Editorial for [Làm quen OJ]. Bài 6. Hàm ceil, floor, round
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Không được in ra trực tiếp giá trị của 3 hàm này, nếu không nó sẽ hiển thị kết quả là số thực thay vì số nguyên
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
//n++ vs ++n
int main(){
double n;
cin >> n;
cout << (int)floor(n) << endl;
cout << (int)ceil(n) << endl;
cout << (int)round(n) << endl;
return 0;
}
Comments