Выводит 2 строки: Сам массив(20 элементов от 10 до 99) и строку с номерами элементов кратных 7, если таковых элементов нет, то пишет No elements.
program test; uses crt; const t:boolean=false; var arr:array[1..20] of integer; i:integer; begin randomize; clrscr; for i:=1 to 20 do begin arr[i]:=random(90)+10; write(arr[i],' '); end; writeln; for i:=1 to 20 do if arr[i] mod 7 = 0 then begin write(i,' '); t:=true; end; if t=false then write('No elements'); end.
1. var a: array [0..12] of integer; i, k: byte; min: integer; begin Randomize; for i:=0 to 12 do begin a[i]:=random(15)-4; write(a[i]:4); end; min:=a[0]; for i:=1 to 12 do if a[i] < min then begin min:=a[i]; k:=i; end; writeln; writeln('Min v pozicii ', k, ' = ', a[k]); readln; end.
2. var a: array [1..6] of integer; i: byte; begin for i:=1 to 6 do begin write(i, ' = '); readln(A[i]); end; writeln; for i:=1 to 6 do begin if i mod 2 = 0 then A[i]:=0; write(A[i], ' '); end; readln; end.
program test;
uses crt;
const
t:boolean=false;
var
arr:array[1..20] of integer;
i:integer;
begin
randomize;
clrscr;
for i:=1 to 20 do
begin
arr[i]:=random(90)+10;
write(arr[i],' ');
end;
writeln;
for i:=1 to 20 do
if arr[i] mod 7 = 0 then
begin
write(i,' ');
t:=true;
end;
if t=false then
write('No elements');
end.
var
a: array [0..12] of integer;
i, k: byte;
min: integer;
begin
Randomize;
for i:=0 to 12 do
begin
a[i]:=random(15)-4;
write(a[i]:4);
end;
min:=a[0];
for i:=1 to 12 do
if a[i] < min then
begin
min:=a[i];
k:=i;
end;
writeln;
writeln('Min v pozicii ', k, ' = ', a[k]);
readln;
end.
2.
var
a: array [1..6] of integer;
i: byte;
begin
for i:=1 to 6 do
begin
write(i, ' = ');
readln(A[i]);
end;
writeln;
for i:=1 to 6 do
begin
if i mod 2 = 0 then A[i]:=0;
write(A[i], ' ');
end;
readln;
end.