what is the difference between while loop and for loop
Answers
Answer:
1. In for loop, initialization, condition checking, and increment or decrement of iteration variable is done explicitly in the syntax of a loop only whereas, in the while loop we can only initialize and check condition in the syntax of the loop.
2. When we are aware of the number of iterations that has to occur in an execution of a loop then we use for loop. On the other hand, if we are not aware of the number of iteration that has to occur in a loop then we use while loop.
MARK MY ANSWER AS BRAINLIST
Explanation:
In a while loop the condition is checked at the very beginning, if the condition is found to be false then further execution stops and the loop is not executed at all whereas in a do.. while loop the test condition is checked at the end of the loop. Therefore, the loop is executed for at least once even if the condition is false
Please mark me as brainliest