CISY 125 - In-Class Lab #12

Arrays

Overview: Change the program from In-Class Lab 11. Calculate the Average of the numbers entered. For each of the numbers entered, show the difference to the average.

In the first For loop for the Input, total up the temperatures.

After the first loop, calculate the average as Average = Total / 5

In the second loop, display the numbers from the array and the difference to the average.

Sample Run

Enter Temp? 95 Enter Temp? 85 Enter Temp? 80 Enter Temp? 90 Enter Temp? 70 The Average is 84 The Numbers Entered Are 1 - 95 11 2 - 85 1 3 - 80 -4 4 - 90 6 5 - 70 -14

Save the file as InLab12.BAS

Submitting the program

  1. Submit the QBasic code electronically (either hand in the In-Class Floppy, or e-mail the QBasic code)
  2. Submit the QBasic code on paper.