Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Check Whether Number is Palindrome Or Not

Article:
Viewed:  1184 
Posted On:  24/07/2013 04:20:07 
Hi all,With the help of this article i am going to tell you that how we can check the number is palindrome or not.......... 

 

Below is my code:


import java.util.Scanner;
class palindrome
{
public static void main(String s[])
{
int a,b,c=0,d;
System.out.println("enter  no. ");
Scanner scan=new Scanner(System.in);
a=scan.nextInt();
System.out.println("you entered ="+a);
b=a;
while(a!=0)
{
d=a%10;
c=c*10+d;
a=a/10;
}
if(c==b)
{
System.out.println("no is palindrome");
}
else
{
System.out.println("no. is not palindrome");
}
}
} 

 Step 1:
  After writing this in notepad save the file with the name followed by (.java) for eg. I Save it with palindrome.java
 
 Step 2 : Open command prompt 
 
 Step 3 : Write javac palindrome.java - Press Enter for compilation

       Step 4 : Write java palindrome for execution

  Output:

Palindrome.png

Image 1.

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us