# Solution 2

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

2Fa - Solution

```   1: (* Author:    Tao Yue
2:    Date:      19 June 1997
3:    Description:
4:      Find the sum and average of five predefined numbers
5:    Version:
6:      1.0 - original version
7:      2.0 - read in data from keyboard
8: *)
9:
10: program SumAverage;
11:
12: const
13:   NumberOfIntegers = 5;
14:
15: var
16:   A, B, C, D, E : integer;
17:   Sum : integer;
18:   Average : real;
19:
20: begin    (* Main *)
21:   write ('Enter the first number: ');
23:   write ('Enter the second number: ');
25:   write ('Enter the third number: ');
27:   write ('Enter the fourth number: ');
29:   write ('Enter the fifth number: ');
31:   Sum := A + B + C + D + E;
32:   Average := Sum / 5;
33:   writeln ('Number of integers = ', NumberOfIntegers);
34:   writeln;
35:   writeln ('Number1:', A:8);
36:   writeln ('Number2:', B:8);
37:   writeln ('Number3:', C:8);
38:   writeln ('Number4:', D:8);
39:   writeln ('Number5:', D:8);
40:   writeln ('================');
41:   writeln ('Sum:', Sum:12);
42:   writeln ('Average:', Average:10:1);
43: end.
```