Why the answer is 814 and not 815? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
20th Oct 2020, 9:17 PM
Kostas
Kostas - avatar
2 Answers
+ 4
If you print z, you'll see it stores 889 and not 890. I'm guessing it has something to do with the tricky nature of floats. Try using the round function (defined in <math.h> header file): z = round(y * 100);
20th Oct 2020, 9:32 PM
Zerokles
Zerokles - avatar
0
Thanks for your help
21st Oct 2020, 8:28 AM
Kostas
Kostas - avatar