Showing posts with label palindrome-number. Show all posts
Showing posts with label palindrome-number. Show all posts

Monday, July 27, 2020

Write a program to input a number and check whether it is Palindrome Number or not?(121=121)

56)  Write a program to input a number and check whether it is Palindrome Number or not?(121=121)


import java.util.*;
public class Palindrome
{
     public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int k = a;
              int r = 0;
              while(k>0)
              {
              int d = k%10;
              r=(r*10)+d;
              k=k/10;
              }
              if(r==a)
              {
                  System.out.println("Entered number is a PALINDROME Number ");
              }
              else
              {
                  System.out.println("Entered number is not a PALINDROME Number ");
              }
   }
}

Output : 


  
palindrome-number



 jhvghvgk ;nkjn ,nkjhj