Java Programming

Palindrome Number

Java example for checking the given number is palindrome number or not

8/30/2021
0 views
palindrome-number.javaJava
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!
Java programmingPalindrome NumberJava Language Tutorial

Loading comments...

Related Examples

Deliver breaking news, insightful commentary, and exclusive reports.

Targeting readers who rely on our platform to stay ahead of the curve.

Contact Us: benzingaheadlines@gmail.com