+ 1

Given a positive real number,print its first digit to the right of the decimal point.

ex : input: 1.79 output: 7 Could someone do it for me?

27th Jan 2019, 3:31 PM
周志桓
周志桓 - avatar
2 Respuestas
+ 14
- Multiply with ten to shift the decimal point one place to the right - int() to get rid of remaining decimal places - mod 10 to get last digit before decimal point
27th Jan 2019, 3:39 PM
Anna
Anna - avatar
0
Thanks
27th Jan 2019, 3:54 PM
周志桓
周志桓 - avatar