## Analysis of a problem

In this exercise, we shall look into the creation of a solution to a given problem. Let us assume a very basic problem to do with. We will analyze and design an algorithm for the solution.

## Sample problem

## Analysis

To analyze the sample problem above, there are three things we need to look out for in the given problem. These are:

- the input
- the output
- the process

### The input

This is simply the parameters that are given in the problem, and for the above problem, they are:

- the total number of students, which is five.
- the individual scores, which are 40, 78, 91, 59 and 12.
- the overall score, which is 100.

### The output

This is what the program is expected to do - the expected outcome, what the user would see, finally after the process. Usually, we look at the process ( calculations before the output). We are expected to compute the values for the:

- sum of the scores
- average of the scores
- number of students who scored above the average score
- number of students who scored below the average score

### Note

Usually, the desired output dictates how to compute on the input to obtain the output.

### The process

From the problem, we are to compute the sum of the scores and the others. Our focus here is to find how to achieve the output. Most often, there would be a straight forward formula to use, other than that we have to find it. So now, all we have to think about is how to compute the :

- sum of the scores
- average of the scores
- number of students who scored above the average score
- number of students who scored below the average score

### Note

The result from the computation is what becomes our output though not all becomes the output.

continuation in

`exercise 5 b (Design of a solution)`

## Discussion (0)