Computer Science, asked by ksaniangnisa, 19 hours ago

what is the similarity and difference between for ans while loop? explain​

Answers

Answered by rasheedapm
0

Answer:

Here are few differences:

For loop

Once the statement(s) is executed then after increment is done.

It is normally used when the number of iterations is known.

while loop

Increment can be done before or after the execution of the statement(s)

It is normally used when the number of iterations is unknown.

Answered by BrainlyHH
0

Answer :-

Similarities :-

• Both for and while are entry-controlled loops.

they both will check the condition for true or false. If the condition is true then only the entry within the loop is permitted.

Differences :-

• One difference between while and for loop is that while loop is best suited for those situations where the number of iterations are not known in advance

where as for loop is best suited for those stations where the number of iterations are already known in advance.

Similar questions