find last digit of number 1

find last digit of number

//C++
int last_digit = number % 10;

Here is what the above code is Doing:
1. We use the modulo operator (%) to get the remainder of number / 10.
2. We assign the result to last_digit.
3. We print last_digit.

Similar Posts