write a program to ask for input from the user and check whether it's a palindrome number or not..!!
( using InputStreamReader ) .
wrong answer will be reported!!
Answers
Answered by
2
Answer:
Program:-
//Program using InputStream
import java.io.*;
public class Main
{
public static void main(String args[ ])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(read);
int n,a,r=0,num=0;
System.out.println("Enter the number");
n=Integer.parseInt(in.readLine());
num=n; //In order to make the value of orignal number safe
while(n!=0)
{
a=n%10;
r=r*10+a;
n=n/10;
}
if(r==num)
System.out.println(num + " is a Palindrome number");
else
System.out.println(num + " is not a Palindrome number");
}
}
- The first photo is the program.
- The second photo is the output for a palindrome number.
- The third photo is the output for a palindrome number.
More information:-
- A palindrome number is a number is which the orignal number and the number formed by reversing the digits are equal.Ex 11,101,202,303 etc
Attachments:
Similar questions
Computer Science,
1 month ago
English,
1 month ago
Science,
1 month ago
Science,
2 months ago
Social Sciences,
9 months ago
Geography,
9 months ago
English,
9 months ago