Palindrome Number :Java Program

package javaPrograms;

import java.util.Scanner;

public class  PalindromeNumber
{

public static void main(String args[])
{
int reversedNumber=0;

System.out.println("Enter no to test palindrome or not");

Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int originalNumber=n;

while(n>0)
{
int temp=n%10;
n=n/10;
reversedNumber=reversedNumber*10+temp;
}



if(reversedNumber==originalNumber)
{
System.out.println("No is Palindrome");

}
else
{
System.out.println("No is not Palindrome");
}


}
   

}


Output
--------------------------------------------------------------------------------------------------------------------------
Enter no to test palindrome or not

212

No is Palindrome

Post a Comment

2 Comments

  1. Selenium |Training|Job Support|+91-741-626-7887 Selenium a Web based automation tool that automates anything and everything available on a Web page.   http://laymanlearning.com/selenium-training/ --- Send Enquiry --- hr@laymanlearning.com

    ReplyDelete
  2. Thanks, Experience with various technologies and businesses this is generally helpful.
    Still, I followed step-by-step your method in this selenium training
    selenium certification
    selenium online training India
    selenium online courses

    ReplyDelete
Emoji
(y)
:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
x-)
(k)