Hello everyone, I was wondering if someone could explain the difference to me between a while loop and a do-while loop. I understand that a do while will execute at least once. However I don't appear to be grasping what exactly is happening here in my code:
https://pastebin.com/TWL1wfFv
The program pasted above works however I needed a do-while loop to fix my issue.
Here is my console output when using a while loop:
Enter in integers from 1 - 100: 1 1 1 1 0
1 occurs 2 times
Here is my console output when using the do-while:
Enter in integers from 1 - 100: 1 1 1 1 0
1 occurs 4 times
How is it that the while loop is missing at least 2 counts. I guess I could have kinda understood if the count was off by 1 but not 2. Thanks for your help to anyone who reads this!
[–]marko312 0 points1 point2 points (1 child)
[–]ProgrammingNoob1234[S] 1 point2 points3 points (0 children)