если массив заполняется случайными числами , то
var
mas: array[0..31]of word;
a, b, c: integer;
begin
b := 10000;
c := 10000;
for a := 0 to 29 do
begin
mas[a] := random(9999) + 1;
if mas[a] mod 2 = 0 then begin if mas[a] < b then b := mas[a]; mas[30] := mas[30] + 1; end;
if mas[a] mod 2 = 1 then begin if mas[a] < c then c := mas[a]; mas[31] := mas[31] + 1; end;
end;
if mas[30] = 0 then b := 0;
if mas[31] = 0 then c := 0;
for a := 0 to 29 do begin if mas[a] > c + b then mas[a] := mas[a] - c - b; writeln(mas[a]); end
end.
если массив заполняется вручную , то
label o;
var
mas: array[0..31]of word;
a, b, c: integer;
begin
b := 10000;
c := 10000;
for a := 0 to 29 do
begin
o:
read(mas[a]);
if (mas[a] < 1)or(mas[a] > 10000) then goto o;
if mas[a] mod 2 = 0 then begin if mas[a] < b then b := mas[a]; mas[30] := mas[30] + 1; end;
if mas[a] mod 2 = 1 then begin if mas[a] < c then c := mas[a]; mas[31] := mas[31] + 1; end;
end;
if mas[30] = 0 then b := 0;
if mas[31] = 0 then c := 0;
for a := 0 to 29 do begin if mas[a] > c + b then mas[a] := mas[a] - c - b; writeln(mas[a]); end
end.
1)var
chislo,max:integer ;
begin
Writeln('Введите числа');
max:=0;
Read(chislo);
while chislo <> 0 do
begin
If(chislo>max) then
max:=chislo;
Read(chislo);
end;
Writeln('Наибольшие число из веденных является ',max);
end.
2)
var
chislo,di,k:integer;
begin
Writeln('Введите число');Readln(chislo);
for di:= 1 to chislo do
begin
if((chislo mod di) = 0 ) then
begin
Writeln('Число делится на ',di);
k:=k+1;
end;
end;
if(k>2) then
Writeln('Число',chislo,' не простое');
if(k=2) then
Writeln('Число ',chislo,' простое');
end.
Объяснение: