Ask Question
6 August, 14:14

IGCSE Pseudocode

Design an algorithm that asks the user for 15 numbers. The algorithm should work out the total and average of all of the values entered that are in the range of 1-10, then output the number of values in the range, the total and the average.

Write the algorithm as pseudocode and a flowchart.

Eg: If you enter the following data (5, 10, - 2, 9, 1, 2, 3, 14, 1, - 6, 4, 15, 1, 0, 4) the output should be

Number of values = 10

Total = 40

Average = 4

Draw a trace table and show it works for the following test dа ta:

3, 9, 12, - 9, 4, 20, 1, 4, - 1, 6, 0, 3, 11, 7, 7

+2
Answers (1)
  1. 6 August, 14:33
    0
    The algorithm works out the total and average of all of the values entered that are in the range of 1-10, then output the number of values in the range, the total and the average.

    Explanation:

    First Program finds the average of specified array elements.

    Below is the pseudocode for 15 numbers:

    public class JavaExample {

    public static void main (String[] args) {

    double[] arr = [15];

    double total = 0;

    for (int i=0; i
    total = total + arr[i];

    }

    double average = total / arr. length;

    System. out. format ("The average is: %.3f", average);

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “IGCSE Pseudocode Design an algorithm that asks the user for 15 numbers. The algorithm should work out the total and average of all of the ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers