View Single Post
Old 10-08-2003, 10:59 PM   #1 (permalink)
Stupidnewb
Registered User
 
Stupidnewb's Avatar
 
Join Date: Oct 2003
Posts: 6
Stupidnewb is on a distinguished road
Hi Problems with figuring out while loops

Hi all I just started writing my first while/for/do loop and I have this assignment to calculate a user input into printing out a value. I know that seems uber vague so here is a better description:


The user inputs a value n between starting with two then I output the sum of n odd integers. So if they enter 3 then the output should be 9.

1+3+5 and what I am having trouble with is how to tell the loop when to stop. I mean I set the user input to the variable say 3 and then do I set the number of times the loop runs to another variable and then have the loop break when these two variables are equal? I am very very lost. Please help a girl out I haven't been this confused since I watched the ending of Evangelion!

Stupidnewb is offline   Reply With Quote