Mon Aug 30 2021

Palindrome Number

File Name: palindrome-number.java

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!

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.