In c while using float datatype a default number is showing at last.how to remove it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In c while using float datatype a default number is showing at last.how to remove it?

For example if the required answer is 10.24 then it is showing 10.240001 why this is happening how to remove that 1.

15th Oct 2020, 12:01 PM
rohit
2 Answers
15th Oct 2020, 12:20 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
here: #include <stdio.h> int main() { float a = 10.24f; printf("%.2f", a); return 0; } https://code.sololearn.com/c4PgRNBZ0m1O/?ref=app
15th Oct 2020, 12:21 PM
Flash