Wap to accept a number and check weather it is prime palindrome or boolean
Answers
Answered by
1
Answer:
Here is the java program
public class Palindrome {
public static void main(String[] args) {
int num = 121, reversedInteger = 0, remainder, originalInteger;
originalInteger = num;
// reversed integer is stored in variable
while( num != 0 )
{
remainder = num % 10;
reversedInteger = reversedInteger * 10 + remainder;
num /= 10;
}
// palindrome if orignalInteger and reversedInteger are equal
if (originalInteger == reversedInteger)
System.out.println(originalInteger + " is a palindrome.");
else
System.out.println(originalInteger + " is not a palindrome.");
}
}
Similar questions