Arrays A (5) and B (10) are given. Calculate the sums of the corresponding elements of the arrays. In pascal.
program zz1;
var i, s: integer; // set variables of integer type
a: array [1..5] of integer;
b: array [1..10] of integer;
begin
for i: = 1 to 5 do // get five random numbers and write them into an array
a [i]: = random (51);
for i: = 1 to 5 do // display the resulting array on the screen
write (a [i], ”);
writeln; // go to a new line to display the response
for i: = 1 to 5 do
s: = s + a [i]; // get the sum
writeln (‘sum of the first array =’, s); // display the answer
s: = 0;
for i: = 1 to 10 do // get ten random numbers and write them into an array
b [i]: = random (51);
for i: = 1 to 10 do // display the resulting array on the screen
write (b [i], ”);
writeln; // go to a new line to display the response
for i: = 1 to 10 do
s: = s + b [i]; // get the sum
writeln (‘sum of the second array =’, s); // display the answer
end.