•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 429,786 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,895 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 354 | Replies: 4
![]() |
•
•
Join Date: Jul 2008
Posts: 10
Reputation:
Rep Power: 0
Solved Threads: 0
Try this. It can be made a lot more efficient. Next time please put at least a psuedo code.
Java Syntax (Toggle Plain Text)
import java.io.*; class Pal { public static void main(String args[]) throws IOException { int num,rev=0,temp; boolean flag=true; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); while(flag) { System.out.println("Enter a number:"); num=br.readline(); //To check if it is a 5 digit number if(num/10000>=1 && num/10000<10) flag=false; } temp=num; //Reversing the number while(num!=0) { rev=rev*10+num%10; num=num/10; } if(rev==temp) System.out.println("It is a palindrome"); else System.out.println("Not palindrome"); } }
•
•
•
•
Try this. It can be made a lot more efficient. Next time please put at least a psuedo code.
Handing students who have shown no effort at all on their assignment the answer is against the spirit of this forum, as evidenced by this prominent post at the top of the forum: http://www.daniweb.com/forums/announcement9-2.html
You are rewarding laziness and fostering incompetence.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: How do you save a JPanel as a GIF file?
- Next Thread: Need TypeReader to PDF batch program



Linear Mode