+1 (208) 254-6996 [email protected]

2.5 Guided PracticeUsing a While() Loop for Repetition

Another iteration statement is the While() loop.  The while loop syntax is a bit different from a for () loop.  With the while loop, we start with the counter control variable of the loop which is set to the starting point using an assignment statement.  Next, will be the condition that needs to be met or the ending of the loop.  Inside of the loop, you will find either the incrementor or decrementer assignment statement which keeps the loop moving until the counter control variable meets the condition and the loop ends.  If you do not include the incrementing/decrementing statement inside of the loop the counter control variable will not change and you will end up with an infinite loop (a loop that never ends).

Don't use plagiarized sources. Get Your Custom Essay on
2.5 Guided PracticeUsing a While() Loop for Repetition
Just from $13/Page
Order Essay

While loops are also known as indeterminant loops.  An indeterminant loop is a loop that does not necessarily have a particular starting point.  Indeterminant loops are used when you want the user to decide to end the loop.  Sentinel values are also used with indeterminate loops.  A sentinel value is a special value that is chosen by the user to end the loop.

The program below uses a while loop to allow the user to enter 5 temperatures.  The while loop also holds an accumulating total statement and counter assignment statement to keep track of totals so that the average of the temperatures can be computed outside of the loop.  Once the average is calculated the average degrees are displayed on the screen as a float value with 2 decimal places.



Follow these instructions to complete your assignment:

1. Use Flowgorithm to create the flowchart in the tab below.

2. Select the Code tab and enter the code into your compiler.

3. Compile your code and run. Your output should match the image on the Output tab.

4. Paste your flowchart and a screenshot of your output (including the Title Bar showing the path and name of your code) into a Word document (.docx).

5. Submit the “.c” code file, which should include a comment line with your name and the date.

6. Submit the Flowgorithm (.fprg) file.

7. Save your files and upload them using the instructions below.


Diagram  Description automatically generated

Diagram  Description automatically generated Diagram, text  Description automatically generated Graphical user interface, text, application  Description automatically generated Text  Description automatically generated






Order your essay today and save 10% with the discount code ESSAYHELP