Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 1.1 KB

060-flowchart.md

File metadata and controls

41 lines (26 loc) · 1.1 KB

60 - Flowchart

Written by Emily Leng

Problem

How do loops work? Examine the flowchart left for you, then match the letter choices to the correct loop. Submit the result of the loops in the order the diagrams are drawn (without line breaks or spaces) as your solution.

Clarification: the "flag" should be the output of the loops in the order they are shown (without line breaks or spaces), not the letter choices.

Hint

Java has several types of loops - for, for each, while, do-while - how do they differ from each other? And how do flow controls like breaks or switch statements affect how code runs?

Solution

The multiple choices for the loops in the order as drawn are:

  1. B
  2. A
  3. C
  4. E
  5. F
  6. D

Their corresponding outputs (without line breaks or spaces) can be logically thought out, run in java, or translated to another language and then run if you don't like java. Anyway, you end up with these:

  1. 024024024
  2. 01234
  3. 07325
  4. 01234
  5. 020202
  6. 0297499161411161614111616131818

Flag

0240240240123407325012340202020297499161411161614111616131818