Powered by Blogger.

Palindrome number program in java



Palindrome number program in java

Hello friends here we write Palindrome number program in java . Palindrome number is; whenever your reverse number it will be same like original number. Example; 121, 787 etc.

Palindrome number program in java

Example of Palindrome number Program in Java

class PalindromeProgram
{
public static void main(String args[])
{
int num, n,rev, rem;
n = num;
reverse=0;
System.out.println("Enter any number: ");
num = Integer.parseInt(args[0]);
while(num > 0)
{
rem = num % 10;
rev = rev * 10 + rem;
num = num / 10;
}
if(rev == n)
System.out.println(n+" is a Palindrome Number");
else
System.out.println(n+" is not a Palindrome Number");
}
}

Output:

Enter any number: 121
121 is a Palindrome Number



facebook
google-plus
twitter
pinterest

No comments :

Post a Comment

HTML Tutorial

images

About Sitesbay

This blog is related to Java Tutorial, C++ Tutorial, C Tutorial, Online Earning tips and more in very simple and easy way. Here i will try to give complete idea related to all new technology.

Java Tutorial

Java is Object oriented programming language, It is more secure and high performance language.

C++ Tutorial

C++ is also Object oriented programming language, It is more simple and easy to learn.

 
https://sitesbay.blogspot.com/?utm_medium=d2898efa59afcc0bc411921036e22b767ca37b09