Computer Science, asked by jennifer639, 10 months ago

write a program to input a number and check whether it is palindrome or not?
plz answer me fast.....!!!!!​

Answers

Answered by Parzival56017
3

Answer:

import java.util.*;

 

public class Palindrome

{

   public static void main(String args[]){

       int num,tNum,sum;

         

       Scanner bf=new Scanner(System.in);

         

       //input an integer number

       System.out.print("Enter any integer number: ");

       num= bf.nextInt();

         

       //find reverse number

       tNum=num;

       sum =0;

       while(tNum>0)

       {

           sum = (sum*10) + (tNum%10);

           tNum/=10;

       }

         

       //check inputted number with reversed number

       if(num==sum)

           System.out.println(num + " is a Palindrome Number.");

       else

           System.out.println(num + " is not a Palindrome Number.");

   }

}

Explanation:

Answered by shrabanigupta2010
0

class palindrome

{

public static void main(int n)

{

int m=n,r,s=0;

for(n!=0;n=n/10)

{

r=n÷10;

s=s+r;

}

if(m==s)

System.out.println("palindrome no.");

else

System. out.println("not a palindrome number");

}

}

Similar questions