c 2b 2b round number to whole

Solutions on MaxInterview for c 2b 2b round number to whole by the best coders in the world

showing results for - "c 2b 2b round number to whole"
Mira
30 Sep 2020
1#include <iostream>
2#include <cmath>
3
4using namespace std;
5
6int main()
7{
8	double num1 = 4.8;
9  	double num2 = 4.3;
10  	cout << ceil(num1) << endl; // --> 5
11  	cout << ceil(num2) << endl; // --> 5
12}
Karl
15 Aug 2017
1#include <iostream>
2#include <cmath>
3
4using namespace std;
5
6int main()
7{
8	double num1 = 4.8;
9  	double num2 = 4.3;
10  	cout << round(num1) << endl; // --> 5
11  	cout << round(num2) << endl; // --> 4
12}