good day, im having trouble converting for loop to while loop. i did the "input number of student having 3 quizes each and get the average" in for loop. the problem is that I'm trying it in while loop. i followed the format of while like this:
im trying to input something here just to test it but, when i try to input 2 or more number of students it just stops at 1 student and end the program. i followed the format of nested while and i cant figure out what went wrong. any help would be appreciated.
oh.. i set it to 0, i see my mistake and thanks for the help. but, why do i have to put a reset on y? i have my initialization on the top which y=1. so, inner while does not read the initialization on the top and when using nested while loop i have to always reset it? i have no problem doing this on for loop. thnx again
First, you set your y value to 1. Then the outer while loop executes, but it doesn't automatically reset things. That's just how while loops work. A for loop works differently. All for loops can be written as while loops, but usually the for version is shorter.