How do I round a result to the nearest whole number.... Cos i tried casting but my result variable is printing zero | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do I round a result to the nearest whole number.... Cos i tried casting but my result variable is printing zero

29th Jan 2021, 5:06 AM
Abdulmuizz Hamzat
Abdulmuizz Hamzat - avatar
3 Answers
+ 2
Adding 0.5 and using a round() function is a common way.
29th Jan 2021, 7:07 AM
Sonic
Sonic - avatar
+ 1
Can you show your code?
29th Jan 2021, 5:24 AM
Sonic
Sonic - avatar
0
Aiit.. Thanks a lot Sonic... Id get back to u on this
31st Jan 2021, 9:54 PM
Abdulmuizz Hamzat
Abdulmuizz Hamzat - avatar