Introduction
In this blog, I will explain about Palindrome (Numbers) program, using Java. It is very simple in Java Programming. The output will be displayed in the Run module.
Software Requirement
JDK1.3.
Simple Program
- import java.io.*;
- class palind {
- public static void main(String arg[]) throws IOException {
- DataInputStream dr = new DataInputStream(System.in);
- System.out.println("Enter the Number : ");
- int no = Integer.parseInt(dr.readLine());
- int d, r, a;
- r = 0;
- a = no;
- while (no != 0) {
- d = no % 10;
- r = r * 10 + d;
- no = no / 10;
- }
- if (a == r)
- System.out.println("The given Number is Palindrome");
- else
- System.out.println("The given Number is Not Palindrome");
- }
- }
In this blog, I explained about Palindrome (Numbers) program, using Java. The output will be displayed in the Run module.
Output