Simple Loops

The goal for this exercise is to understand how to use both

What you need to do to prepare for this exercise:


What you need to do for this exercise

In the provided starter project, fill in the Simple_Loops.RunExercise method so that that displays a pattern on the screen, similar to the following:

  *****

The user should be prompted to enter the length of the line before the loop starts to run.

 

Make sure that you can do this with both a while loop, a do…while loop and a for loop.

    while( <expression> )
    {
        // multiple statements here.
        // Once all the statements have been executed, go back to the while
    }
    
    for( <initializing expression> ; <checking expression> ; <increment expression>)
    {
      // multiple statements here.
      // Once all the statements have been executed,
// go back to the <increment expression>, then // the <checking expression>, then (if true) back through the loop }
    do
    {
        // multiple statements here.
        // All the statements will be guaranteed to execute the first time
        // Then check and see if <expression> is true. If so, then
        // go back to the top of the loop & start over. If not, then leave
        // the loop
    }
    while( <expression> ) ; // note the REQUIRED semi-colon
          // that the other loops DON'T have
          
Here's an example of the sort of output that your program might produce (user input is in bold italics):
How many stars would you like to see	(while loops): 3
***
How many stars would you like to see	(for loops): 5
*****
How many stars would you like to see	(for loops): 5
*****