This question has already been answered:

The user enters a three-digit number, the first and last digit of which must be compared. But unfortunately indexes do not work with numbers. Tell me, what is the way out?

Reported as a duplicate by Dmitriy Simushev , pavel , post_zeew , Community Spirit Nov 7 '16 at 20:19 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • one
    Division and remainder of division use. - Vladimir Martyanov
  • as you read the numbers from the user. Show the specific code (only the part that reads the numbers) — edit the question and add this code there, click edit . You should get a string (in which indexes work) - jfs

1 answer 1

The first digit of the number is obtained by dividing by 100 completely, the last one by taking the remainder of dividing by 10. We compare the results to each other.