problem with while loop

I'm struggeling with this while loop cause I feel they don't give me enough info. I'm suppose to write a while loop about the folloing info:

Two variables: results and programsDone.

Loop must execute until result is greater or equal to 50 and programsDone greater or equal to 5.

Please help.....
They give you enough info to write the while loop control expression. Now you can stop feeling like they don't.

Make an attempt.
Ok well I'm new to this so don't laugh if I do it wrong. If u right is like this:

While (result >=50) || (programsDone >=5)

Is there anything wrong?
result is greater or equal to 50 and programsDone greater or equal to 5.


1
2
3
4
while (result >= 50 && programsDone >=5)
{
  // Stuff here
}
closed account (zb0S216C)
It's right in front of you:

Stephie22 wrote:
Two variables: results and programsDone.


Stephie22 wrote:
Loop must execute until result is greater or equal to 50 and programsDone greater or equal to 5.


Wazzak
Last edited on
Thanx for the help, knew I was doing something wrong.
Hi,

Should it not be

while (result < 50 && programsDone < 5)
{
// Stuff here
}

as it should execute until the values are greater than or equal to 50 or 5?

Also very new here.

Thanks
Last edited on
Yes, Rascal, you are right.

As long result is smaller than 50 the loop must execute. The same for programsDone. If one of them exceeds the limit the AND-condition is not true and the loop will still continue until both are greater or equal to the limits.
Last edited on
Topic archived. No new replies allowed.