aspose file tools*
The moose likes Beginning Java and the fly likes while loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

while loop

Jim Harvey
Greenhorn

Joined: Jun 08, 2007
Posts: 7
Can someone pls show me or get me started in the right direction for writing a while loop to perforem the following steps:

1. Prompt the user to input two integers: dirstNum and secondNum.
2. Output all results to a file, placing an appropriate lable between each section of output.
3. Output all odd numbers between firstNum and secondNum.
4. Output the sum of all even numbers between firstNum and secondNum.
5. Output the numbers and their square between firstNum and secondNum.
6. Output the sun of the squares of the odd numbers between firstNum and secondnum.

Thank you very much/jrh
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Not an advanced question. Moving...


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Andris Jekabsons
Ranch Hand

Joined: Jan 20, 2004
Posts: 82
You can divide your assignment in several parts: receiving input from user, writing to a file and performing calculations on numbers. Read more about the first two on Java Tutorial and then you can ask more specific questions.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11302
    
  16

This thread is a dup. of this one. Please post any follow ups over there.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: while loop