Course of Raku / Essentials / Numbers / Exercises

The last digit

Problem

Write a program that asks to enter a positive integer number and prints its last digit.

Example

Here is the possible script of interacting with the program:

$ raku the-last-digit.raku
Enter a number: 123
The last digit of 123 is 3.

Solution

See the solution

Next exercise

💪 Sum of numbers from 1 to 100

Course navigation

Strings / String length   |   Boolean type