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");
}
}
}
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
2 Comments
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
ReplyDeleteThanks, Experience with various technologies and businesses this is generally helpful.
ReplyDeleteStill, I followed step-by-step your method in this selenium training
selenium certification
selenium online training India
selenium online courses