The While Loop (1)
int x = 1;
int sum = 0;
while (x != 10) // The guard
{
// The body
sum = sum + x;
x = x + 1;
}
Previous slide
Next slide
Back to first slide
View graphic version