var
a: array of integer;
i, n, k: integer;
begin
randomize;
k := 0;
write('Введите n = ');
readln(n);
SetLength(a, n);
writeln(' *** Сгенерированный массив *** ');
for i := 0 to Length(a) - 1 do
a[i] := random(20) + 1;
write(' ', a[i]);
end;
for i := 1 to Length(a) - 1 do
if (a[i] mod a[0]) = 0 then Inc(k);
writeln(#13 + 'Кол-во элементов кратных "', a[0], '" = ', k);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var
a: array of integer;
i, n, k: integer;
begin
randomize;
k := 0;
write('Введите n = ');
readln(n);
SetLength(a, n);
writeln(' *** Сгенерированный массив *** ');
for i := 0 to Length(a) - 1 do
begin
a[i] := random(20) + 1;
write(' ', a[i]);
end;
for i := 1 to Length(a) - 1 do
if (a[i] mod a[0]) = 0 then Inc(k);
writeln(#13 + 'Кол-во элементов кратных "', a[0], '" = ', k);
end.