+ 1
Please help me in this concept
5 Answers
+ 2
whats specifically would you like to know?
+ 2
the counter variable is what you use to check how many times a loop as ran, so say your teacher punishes you and makes you right "im sorry" on the board 10 times here is what is happening in code
int timesWritten = 0;
while(timesWritten<10){
write("im sorry");
timesWritten++;
}
so every time you write im sorry, your counter increases by one, the counter is timesWritten and without updating this variable the loop would run endlessly.
+ 1
What is counter variable and how it is used so far
+ 1
tq Mr Atkins for your help
0
Tirumala Vinay anytime, glad i could help!