Given an integer number, we have to find reverse number and print it.
Example:
Input:
Number: 12345
Output:
Reverse Number: 54321
To find a reverse number – we use this formula: reverse = (reverse * 10) + lastDigit, to calculate the lastDigit, we find the remainder of the number by dividing the number with 10.
Program to reverse a number in Kotlin
Output
need an explanation for this answer? contact us directly to get an explanation for this answer