+ 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?
2 Answers
+ 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
0
Thanks