| | |
even and odd
![]() |
•
•
Join Date: Oct 2009
Posts: 4
Reputation:
Solved Threads: 0
if and if-else statement:
you will have to write a program that reads a 4-digit positive integer from the user and prints out the following information on the screen:
1. Whether the positive integer is an odd or even number
2. (display) The odd digits of the integer
3. (display) The even digits of the integer
4. Whether the number reads the same forwards and backwards (e.g., 4004, 4444, etc.)
5. Whether all four digits are the same (e.g., 8888)
you will have to write a program that reads a 4-digit positive integer from the user and prints out the following information on the screen:
1. Whether the positive integer is an odd or even number
2. (display) The odd digits of the integer
3. (display) The even digits of the integer
4. Whether the number reads the same forwards and backwards (e.g., 4004, 4444, etc.)
5. Whether all four digits are the same (e.g., 8888)
•
•
Join Date: Jun 2004
Posts: 609
Reputation:
Solved Threads: 7
1
#3 Oct 22nd, 2009
1st Part
second part
third part
last part
well you should be able to compare if
both number are equal
What would you kids do without richard west doing your homework
Richard West
Java Syntax (Toggle Plain Text)
public void posneg (String str1) { Convert the string to int Divide it by 2, if there is a remainder, its odd if not even }
second part
Java Syntax (Toggle Plain Text)
public void numposneg (String str2) { see the String api, there is an api that converts the string to a char array call posneg }
third part
Java Syntax (Toggle Plain Text)
public void numposneg (String str2) { see the String api, there is an api that converts the string to a char array compare the first and last index only }
last part
well you should be able to compare if
both number are equal
What would you kids do without richard west doing your homework
Richard West
Last edited by freesoft_2000; Oct 22nd, 2009 at 2:08 pm.
Microsoft uses "One World, One Web, One Program" as a slogan.
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond
Tell me what type of software do you like and what would you pay for it
http://www.daniweb.com/techtalkforums/thread19660.html
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond
Tell me what type of software do you like and what would you pay for it
http://www.daniweb.com/techtalkforums/thread19660.html
![]() |
Similar Threads
- Odd/Even Code (Java)
- Loop counting odd and even numbers (C++)
- Odd Page Cannot Be Displayed Problem (All browsers, not just IE) (Windows NT / 2000 / XP)
- Even / Odd code HELP!! (Java)
Other Threads in the Java Forum
- Previous Thread: Does a .jar file generated in windows by netbeans run properly on mac and linux ?
- Next Thread: Source code
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle plazmic print problem program programming project radio recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree unlimited utility webservices windows






