Created
February 20, 2018 22:33
-
-
Save arrbxr/54565b5f96c3033cb842c0d84f37714b to your computer and use it in GitHub Desktop.
reverse number and palindrome check created by arrbxr - https://repl.it/@arrbxr/reverse-number-and-palindrome-check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Main { | |
| public static void main(String[] args) { | |
| int num = 121, temp , i, reverse = 0; | |
| temp = num; | |
| while(num > 0){ | |
| reverse = reverse*10 + num % 10; | |
| num /= 10; | |
| } | |
| System.out.println(reverse); | |
| if(temp == reverse){ | |
| System.out.println("It is palindrome"); | |
| } | |
| else | |
| System.out.println("It is not palindrome"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment