| | |
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 34 Days Ago
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; 34 Days Ago 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 |
911 actionlistener addressbook android api append applet application array arrays automation binary block bluetooth character class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game gameprogramming givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing system test textfields threads time title tree tutorial-sample ubuntu update windows working






