Palindrome Number

Java Programming

Java Programming Examples

import java.io.*;

class palindrome {
	public static void main(String args[ ]) {
		int no, mod = 0, c = 0, temp;
		System.out.println("Program for Checking Palindrome Number");
		no = Integer.parseInt(args[0]);
		temp = no;

		/* Loop the process using 'while' loop */
		while(no != 0) {
			mod = no % 10;
			c = (c * 10) + mod;
			c = (c * 10) + mod;
			no = no / 10;											
		}
		if(c == temp)
			System.out.print("It's a Palindrome Number!");
		else
			System.out.print("It's not a Palindrome Number!");
	}
}


          /****** Output ******/
          

java palindrome 121


Program for Checking Palindrome Number


It's a Palindrome Number!




---------------------------------




java palindrome 123


Program for Checking Palindrome Number


It's not a Palindrome Number!

Learn more about Palindrome Number