Skip to content

Instantly share code, notes, and snippets.

@Husseinhj
Created June 7, 2022 09:29
Show Gist options
  • Save Husseinhj/8321c08000cf12b78e2451ed7e11c2c9 to your computer and use it in GitHub Desktop.
Save Husseinhj/8321c08000cf12b78e2451ed7e11c2c9 to your computer and use it in GitHub Desktop.
Palindrome
/**
* Kotlin code challenges.
*
*/
fun main() {
println("${rev(465, 0)}")
}
fun rev(number: Int, temp: Int): Int {
if (number == 0) {
return temp
}
return rev(number / 10 , (temp * 10) + (number % 10))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment