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!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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 Respuesta
+ 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