Write a program that inputs a 5-digit integer from the
keyboard and prints if the input number is a palindrome or
not. A palindrome is a number which has the same digit from
either end.
Answer / vinit
import java.io.*;
public class HelloWorld{
public static void main(String []args)throws IOException{
//System.out.println("Hello World");
int n;
int t;
int cpy;
int r,rev;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
t=Integer.parseInt(br.readLine());
while(t!=0)
{rev=0;
n=Integer.parseInt(br.readLine());
cpy=n;
while(n!=0)
{
r=n%10;
n=n/10;
rev=(rev*10)+r;
}
if(rev==cpy)
{System.out.println("palindrome");
t--;
continue;}
else{
System.out.println("not Palindrome");t--;
continue;
}
}
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Explain the unshift() method ?
What is the difference between the substr() and substring() functions in javascript?
What is event bubbling in JavaScript?
Explain the term closure?
How do you include a comment in javascript?
What are different types of popup boxes available in javascript?
Do hackers use javascript?
What is a hash javascript?
How to set the focus in an element using javascript?
How can you set position of the page (top and left) to 0 using javascript in one line code?
what is a code in vb amount display in words
How to force a page to go to another page using javascript ?