ineedhelpnow
- 649
- 0
what is the purpose of a loop variable (i)? how is it useful?
int i=0;
while(i< maxNumberOfIterations)
printf("This is iteration number %d" , i);
i++;
end while
int array [] = {1 , 2 , 3 , 4};
int i=0;
while( i < array.Length)
printf("%d " , array[i++]);
end while
int i=0;
while(ConditionSatisfied())
i++;
end while
printf("The loop ran for %d iterations " , i);
int i=0;
string word = getString();
while(word.hasNextChar())
i++;
end while
printf("the string has %d characters ", i);
ineedhelpnow said:@zaid (Blush) uuuuh i still don't understand. is it used when there's no actual variable to be used only?