Untitled
unknown
plain_text
a year ago
461 B
3
Indexable
public class palindrome {
public static boolean isPalindrome(int n) {
int temp = n, rev = 0;
temp = n;
while(temp > 0) {
int rem = temp % 10;
rev = rev*10 + rem;
temp /= 10;
}
if (rev == n)
return true;
else
return false;
}
public static void main(String[] args) {
System.out.println(isPalindrome(129));
}
}
Editor is loading...
Leave a Comment