Computer Science, asked by anisuddinhasmi, 6 months ago

write a program to input a number and check it is a prime palindrom or not.
by using while loop

plz help me out fast​

Answers

Answered by tiwarishashwat125
0

Answer:

public class Palindrom

{

   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.");

   }

}

Output

121 is a palindrome number.

Explanation:

mark it as brainliest and thanks

Answered by SammitSubudhi
4

Program to Check Whether a Number is Palindrome or Not

while Loop. An integer is a palindrome if the reverse of that number is equal to the original number. Program to Check ...

Similar questions