Infinite while loop

Lets remove the if check from the innermost loop. Now, let's initialize each variable outside of the loops and delete the rows dx = 0. After we run the program we only get 10 results.Why? What if you use do-while? In this case this loop does not look appropriate,doesn't it?Think why. Of course, you can solve the problem using infinite loop.

As we can see, we can solve a problem with different types of loops. Of course, each task has its most appropriate choice.In order to practice each loops - try to solve each of the following problems with all the learned loops.

Testing in the Judge System

Test your solution here:

results matching ""

    No results matching ""