reset password
Author Message
ytsai8
Posts: 47
Posted 15:57 Feb 16, 2014 |
  1. int s = 1;
    int n = 1;
    while ( s < 10 ) { s = s + n; }
    n++; 

Is the n++ suppose to be inside the bracket? or it is what it is?

Last edited by rabbott at 19:43 Feb 16, 2014.
Eric Liao
Posts: 158
Posted 16:23 Feb 16, 2014 |

n++;

is outside of the body of the while loop.

Last edited by rabbott at 19:43 Feb 16, 2014.