City Suvidha...your one stop Search

Java Programs

Go Back to List

Program to Check whether number is palindrome or not.
 

class palindrome
{
public static void main(String args[])
{
System.out.println("Enter number");
int num= Integer.parseInt(args[0]);
int n = num;
int rev=0;
System.out.println("Number: ");
System.out.println(" "+ num);
for (int i=0; i<=num; i++)
{
int r=num%10;
num=num/10;
rev=rev*10+r;
i=0;
}
System.out.println("After reversing the number: "+ " ");
System.out.println(" "+ rev);
if(n == rev)
{
System.out.print("Number is palindrome!");
}
else
{
System.out.println("Number is not palindrome!");
}
}
}
 

Output:

 

If any of you want to submit your programs and contribute to site please mail us at:

citysuvidha@gmail.com

Click here to have a look at  List of programs

You can download all the programs in a zip file also. For this you have to do one thing. Just register at the citysuvidha forum  and start any thread of any topic.  Once you start the thread and put your request, admin will automatically send you the desired zip file.