Ответ:
Объяснение:
program EvenArray;
const
ArraySize=20;
var
a : array [1..ArraySize] of integer;
i,EvenQty, Prod5, Sum5: integer;
begin
for i:= 1 to ArraySize do a[i]:=random(25)-10;
writeln('Default array:');
for i:=1 to ArraySize do write(a[i],' ');
writeln();
Prod5:=1; Sum5:=0; EvenQty:=0;
for i:=1 to ArraySize do begin
if (a[i] mod 5 = 0) and (a[i] <> 0) then begin
Prod5:=Prod5*a[i];
Sum5:=Sum5+a[i];
end;
if a[i] mod 2=0 then EvenQty := EvenQty + 1 else a[i] := 10;
writeln('Production of 5x is: ' , Prod5);
writeln('Sum of 5x is: ', Sum5);
writeln('Even quantity is : ', EvenQty);
Writeln('New array is :');
for i := 1 to ArraySize do write(a[i] , ' ');
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
Объяснение:
program EvenArray;
const
ArraySize=20;
var
a : array [1..ArraySize] of integer;
i,EvenQty, Prod5, Sum5: integer;
begin
for i:= 1 to ArraySize do a[i]:=random(25)-10;
writeln('Default array:');
for i:=1 to ArraySize do write(a[i],' ');
writeln();
Prod5:=1; Sum5:=0; EvenQty:=0;
for i:=1 to ArraySize do begin
if (a[i] mod 5 = 0) and (a[i] <> 0) then begin
Prod5:=Prod5*a[i];
Sum5:=Sum5+a[i];
end;
if a[i] mod 2=0 then EvenQty := EvenQty + 1 else a[i] := 10;
end;
writeln('Production of 5x is: ' , Prod5);
writeln('Sum of 5x is: ', Sum5);
writeln('Even quantity is : ', EvenQty);
Writeln('New array is :');
for i := 1 to ArraySize do write(a[i] , ' ');
end.