{ Teresa Tong [30] F.4AS April, 2002 } { Calculate the total score of each student and the mean score of the 3 test } program p135; uses wincrt; var Score: array[1..10,1..3] of integer; Mean: array[1..3] of integer; Total: array[1..10] of integer; Stud, Test, Sum, i :integer; procedure ComputerScore; var Stud, Test :integer; begin for Stud:=1 to 10 do begin i:=i+1; writeln('Enter the 3 score of Student ',i,':'); for Test:=1 to 3 do readln(Score[Stud, Test]); end; end; procedure ComputerTotal; var Stud, Test :integer; begin for Stud :=1 to 10 do begin Total[Stud]:=0; for Test:= 1 to 3 do Total[Stud] := Total[Stud] + Score[Stud,Test] end end; procedure ComputerTestMean; var Stud, Test, Sum : integer; begin for Test:=1 to 3 do begin Sum :=0; for Stud := 1 to 10 do Sum:=Sum+Score[Stud, Test]; Mean[Test] := round( Sum/10) end end; begin ComputerScore; ComputerTotal; ComputerTestMean; writeln; writeln(' Result:'); writeln; writeln(' The Total Score of each Student are as follow:'); for Stud:=1 to 10 do writeln(' Student ', Stud,' : ',Total[Stud]); writeln; writeln(' The Mean Score of the Test are as follow:'); for Test:=1 to 3 do writeln(' Test ', Test, ' : ', Mean[Test]); end. ========================================================= e.g. Enter the 3 score of Student 1: 89 56 67 Enter the 3 score of Student 2: 78 70 65 Enter the 3 score of Student 3: 50 46 53 Enter the 3 score of Student 4: 72 62 65 Enter the 3 score of Student 5: 65 50 57 Enter the 3 score of Student 6: 73 55 68 Enter the 3 score of Student 7: 81 73 85 Enter the 3 score of Student 8: 54 32 42 Enter the 3 score of Student 9: 64 58 60 Enter the 3 score of Student 10: 83 76 69 Result: The Total Score of each Student are as follow: Student 1 : 212 Student 2 : 213 Student 3 : 149 Student 4 : 199 Student 5 : 172 Student 6 : 196 Student 7 : 239 Student 8 : 128 Student 9 : 182 Student 10 : 228 The Mean Score of the test are as follow: Test 1 : 71 Test 2 : 58 Test 3 : 63