The result should be 2.0 6.0 but it's 2.00000 6.00000 in C. what to do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The result should be 2.0 6.0 but it's 2.00000 6.00000 in C. what to do?

The result should be 2.0 6.0 but it's 2.00000 6.00000 in C. what to do?

19th Nov 2022, 5:37 PM
seerat
seerat - avatar
1 Answer
+ 4
Customize number of digits past the decimal point by specifying precision. Look particularly at the section covering precision in the following page http://www.cplusplus.com/reference/cstdio/printf/
19th Nov 2022, 5:46 PM
Ipang