Skip to content

Instantly share code, notes, and snippets.

@arrbxr
Created February 20, 2018 22:33
Show Gist options
  • Select an option

  • Save arrbxr/54565b5f96c3033cb842c0d84f37714b to your computer and use it in GitHub Desktop.

Select an option

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
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