How round number to the nearest hole number in c++ | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

How round number to the nearest hole number in c++

C++

24th Jun 2020, 6:37 AM
Auwal Iliyasu Ishaku
Auwal Iliyasu Ishaku - avatar
5 Antworten
+ 3
Result equal to 1.28815 If you store this value in integer then it will be 1 If you use floor function then the value will be 1 If you use ceil function then the value will be 2
24th Jun 2020, 6:54 AM
ycsvenom
ycsvenom - avatar
+ 2
double num1 = 46.76; double num2 = 36.3; double result; result = num1 / num2 : Cout<<"result in nearest hole number";
24th Jun 2020, 6:45 AM
Auwal Iliyasu Ishaku
Auwal Iliyasu Ishaku - avatar
+ 2
Thanks
24th Jun 2020, 7:01 AM
Auwal Iliyasu Ishaku
Auwal Iliyasu Ishaku - avatar
+ 1
Can you give me an example?
24th Jun 2020, 6:38 AM
ycsvenom
ycsvenom - avatar
0
You are welcome Auwal Iliyasu Ishaku
24th Jun 2020, 7:02 AM
ycsvenom
ycsvenom - avatar