can someone help me out

Help Help please....


1.)What are the values of the total count after the following executes?
int count = 0,
total = 0;
while (count < 7 )
total += count;
++ count;

Comments

  • : Help Help please....
    :
    :
    : 1.)What are the values of the total count after the following executes?
    : int count = 0,
    : total = 0;
    : while (count < 7 )
    : total += count;
    : ++ count;
    :

    The while loop is an infinite loop, so the program does nothing at all but just sit and spin on those two lines.
  • : : Help Help please....
    : :
    : :
    : : 1.)What are the values of the total count after the following executes?
    : : int count = 0,
    : : total = 0;
    : : while (count < 7 )
    : : total += count;
    : : ++ count;
    : :
    :
    : The while loop is an infinite loop, so the program does nothing at all but just sit and spin on those two lines.
    :
    if the loop was
    while(count<7)
    {
    total+=count;
    ++count;
    }
    then it would: count=7,total=21.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion