Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 1.44 KB

File metadata and controls

24 lines (17 loc) · 1.44 KB

Chapter 7.2. More Complex Loops – Exam Problems

In the previous chapter we learned how to execute a block of commands more than once using a for loop. To improve our knowledge, let's solve some more complicated problems with loops, given at the exams in SoftUni.

More Complex Loops – Quick Review

In the previous chapter we reviewed some loop structures that would help us solve more complex problems:

  • loops with a step (e.g. print the numbers 1, 3, 5, …, n)
  • nested loops (loops located inside other loops)
  • while loops (repeat a block of code while an entrance condition is true)
  • do-while loop (repeat a block of code while an exit condition is true)
  • infinite loops and breaking out of loop (break operator)
  • try-catch construction (handle runtime errors)

Exam Problems

Let's start work on solving the following practical exam problems: