Sei sulla pagina 1di 4

2

4x5

70

17

81

65

76

85

40

82

92

49

16

11

65

11

60

91

75

Dimensional Arrays
Array of Student Scores
0

0
1

2
3

S [0] [3] ? 65
S [3] [2] ? 60

What is the total score of?


S [2] [0] + S [3] [0]
49

5 = 54

What is the 3rd students score?


S [2] [0] + S [2] [1] + S [2] [2] + S [2] [3] + S [2] [4]
49 + 16 + 11 + 0 + 65

= 141

Using the array above draw a flowchart to calculate and display the 3rd
students score. Use a loop.

Display T

T = T + S [2]
[C]
C=C+1

Add the total score for subjects 2 and 3

Display T

T = T + S [1] [C] + S
[C] [2]

C=C+1

Add all the elements in the array

Display T

T = T + S [1] [C] + S
[C] [2]

C=C+1

Potrebbero piacerti anche