0

How can I make the output be 14.45 when the input is 3 because the output right now is 14.445?

Here is the code: https://code.sololearn.com/chSr4MpAZc07/?ref=app

15th Aug 2022, 4:50 AM
eloufou
eloufou - avatar
7 ответов
+ 1
You could round the result
15th Aug 2022, 6:39 AM
Lisa
Lisa - avatar
+ 1
***round the number*** or format the output string
15th Aug 2022, 6:41 AM
Lisa
Lisa - avatar
0
Lisa, Wdym?
15th Aug 2022, 6:40 AM
eloufou
eloufou - avatar
0
Lisa Ooh, I understand! The only problem is that i only know the function 'ceil(varr)' but this one rounds up the number. I only want to round up the second positions after the coma. How?
15th Aug 2022, 6:43 AM
eloufou
eloufou - avatar
0
Have you tried to solve this by Googling for approaches? I found this for instance: https://www.geeksforgeeks.org/rounding-floating-point-number-two-decimal-places-c-c/
15th Aug 2022, 6:46 AM
Lisa
Lisa - avatar
0
Alright thx alot
15th Aug 2022, 6:46 AM
eloufou
eloufou - avatar
0
change the second factor 7/100 for 29/270
15th Aug 2022, 6:56 AM
Cristian Baeza Jimenez
Cristian Baeza Jimenez - avatar