The Right-Most Digit of the Integral Part

Easy

Read one real number and print the right-most digit of its integral part, in the form right-most digit = 3. For 123.45 the integral part is 123 and the answer is 3. Truncate the number to a whole number, do not round it: 9.99 gives 9. The digit is always printed as a value from 0 to 9, even for a negative input, so -56.7 gives 6. If the number cannot be read, print invalid input and return 1.

Success Criteria

Your code must pass 6 test case(s) to complete this exercise. 3 hint(s) are available if you need help.

Sign in to track your progress

You can work on exercises as a guest, but sign in to track your progress and save your submissions.

This platform is built by its community

Every lesson, project, and tool on HelloC++ is funded by sponsors. Join them and help shape what we build next.

Become a Patron

How did you find this exercise?

Your rating helps us improve the content.