DEV Community

hema latha
hema latha

Posted on

Palindrome - program

package day1;

public class Palindrome {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    int no = 191;
    int no2=no;

    int reverse = 0;
     while(no>0)
    {
    reverse = reverse*10 + no%10;              no=no/10;                                
    }
    System.out.println(reverse); 
if(reverse==no2)
    System.out.println("palindram");
else
    System.out.println("not palindram"); 


    }}

out put == 191  palindram
Enter fullscreen mode Exit fullscreen mode

Top comments (0)