Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

while loop

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Not an advanced question. Moving...
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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.
 
lowercase baba
Posts: 13024
66
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
This thread is a dup. of this one. Please post any follow ups over there.
    Bookmark Topic Watch Topic
  • New Topic