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

4 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
    Replies
    1. I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts. Python Projects for Students Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account. Project Center in Chennai

      Delete
  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)