There is a contest! | В настоящий момент идёт турнир. Некоторая информация и функции сервера недоступны до его окончания.
|
|
imesecan | Apr.08.2011 at 04:03:10 PM | |
0 | Use printf command. Using printf you can decide the number of floating point digits. printf ("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416); %f means: Print a floating point number. %4.2f means: Print the floating point number (the first number after the double quotation) totally in for space. and 2 digits after the floating point.
In our case you should use printf ("%0.1f", res); Then it will print res with 1 digit after the floating point. It says 0 there that means the total space is not important print the number as it's with one digit after the floating point.
|
imesecan | Feb.24.2012 at 07:28:51 AM | |
1 | sorry, float precision is not enough, it's better to use "double".
|
|