1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 //ceil()向上取整 5 //floor()向下取整 6 int main(){ 7 int a,b; 8 cin>>a>>b; 9 cout<<"向上取整"<<ceil((double)a/b)<<endl; 10 cout<<"向下取整"<<floor((double)a/b); 11 return 0; 12 }
运行结果: