Заполнить массив из 30 элементов случайными целыми числами. Вывести те значения элементов, которые кратны 5.
Answers & Comments
Erik182
Program n1; var a: array[1..30] of integer; i: integer; begin randomize; for i:=1 to 30 do begin a[i]:=random(30)+1; if a[i] mod 5=0 then write(a[i],' '); end; end.
Const n=30;var a:array [1..n] of integer;i,k:integer;beginfor i:=1 to n do begina[i]:=random(51)-20;write (a[i]:4);if abs(a[i]) mod 5=0 then k:=k+1;end; writeln (k:2); end.
Answers & Comments
var a: array[1..30] of integer;
i: integer;
begin
randomize;
for i:=1 to 30 do
begin
a[i]:=random(30)+1;
if a[i] mod 5=0 then write(a[i],' ');
end;
end.
Verified answer
Const n=30;var a:array [1..n] of integer;i,k:integer;beginfor i:=1 to n do begina[i]:=random(51)-20;write (a[i]:4);if abs(a[i]) mod 5=0 then k:=k+1;end; writeln (k:2); end.