Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is enum with example?

894


How to set a html document's background color?

901


Is javascript server side or client side?

896


How to disable an html object ?

1029


What is the importance of javascript?

876


What is webpack used for?

789


How to get value from a textbox?

1062


Should you disable javascript?

886


What are the four basic data structures in javascript?

934


What kind of conditional statements does JavaScript support?

908


Why javascript is dangerous?

888


List some features of javascript.

1559


What is a Typed Language?

961


Explain with an example the use of event handlers in javascript.

976


What is the context in javascript?

877