Write a kotlin program to reverse a number.

Write a program to reverse a number using numeric operations. Below example shows how to reverse a number using numeric operations.

fun reverseNumber(number: Int): Int {
    var number = number

    var reverse = 0
    while (number != 0) {
        reverse = reverse * 10 + number % 10
        number = number / 10
    return reverse

fun main(a: Array<String>) {
    var num = 12346598
    println("Original Number : " + num)
    println("Reversed Number : " + reverseNumber(num))


Original Number : 12346598
Reversed Number : 89564321


Join My Facebook Group
Join Group

About Author

Myself KarthiQ, I am the author of this blog, I know ways to write a good article but some how I donot have the skills to make it to reach people, would you like help me to reach more people By sharing this Article in the social media.

Share this Article Facebook
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions