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 |
Does javascript support foreach loop?
How we can get the value of an element using javascript?
How you will write a java script function that display an alert on the screen?
What is argument objects in javascript?
What is the difference between ‘let’ and ‘const’?
What is the use of Void(0)?
what are the differences between as2 and as3?
Is notepad ++ an ide?
What is strict mode in javascript?
What is the best site to learn javascript?
1) How can we use java script in testing the application? 2) What all the things(Software application - like browser, notepad) we need to learn Jscript?
In which location cookies are stored on the hard disk?