var mas:array[0..9] of integer; i,max,min,k:integer; arifm:real; begin k:=0; arifm:=0; Randomize; for i:=0 to 9 do mas[i]:=Random(15); for i:=0 to 9 do write(mas[i],' '); {poisk max} max:=mas[0]; for i:=1 to 9 do if max<mas[i] then max:=mas[i]; {poisk min} min:=mas[0]; for i:=1 to 9 do if min>mas[i] then min:=mas[i]; arifm:=(max+min)/2; writeln('max: ',max); writeln('min: ',min); writeln('arifm: ',arifm:0:3); for i:=0 to 9 do if mas[i]<arifm then inc(k); writeln('k: ',k); readln; end.
Var n, i, growth, growth_girls, growth_boys, count_boys, count_girls: integer; begin writeln('Введите количество учеников в классе'); read(n);
growth_girls := 0; growth_boys := 0; count_boys := 0; count_girls := 0; for i := 1 to n do begin read(growth); if (growth < 0) then begin growth_boys := growth_boys - growth; count_boys := count_boys + 1; end else begin growth_girls := growth_girls + growth; count_girls := count_girls + 1; end; end;
if (count_boys = 0) then writeln('В классе нет мальчиков') else writeln('Средний рост мальчиков: ', (growth_boys / count_boys):0:2);
if (count_girls = 0) then writeln('В классе нет девочек') else writeln('Средний рост девочек: ', (growth_girls / count_girls):0:2); end.
i,max,min,k:integer;
arifm:real;
begin
k:=0;
arifm:=0;
Randomize;
for i:=0 to 9 do
mas[i]:=Random(15);
for i:=0 to 9 do
write(mas[i],' ');
{poisk max}
max:=mas[0];
for i:=1 to 9 do
if max<mas[i] then
max:=mas[i];
{poisk min}
min:=mas[0];
for i:=1 to 9 do
if min>mas[i] then
min:=mas[i];
arifm:=(max+min)/2;
writeln('max: ',max);
writeln('min: ',min);
writeln('arifm: ',arifm:0:3);
for i:=0 to 9 do
if mas[i]<arifm then
inc(k);
writeln('k: ',k);
readln;
end.
begin
writeln('Введите количество учеников в классе');
read(n);
growth_girls := 0;
growth_boys := 0;
count_boys := 0;
count_girls := 0;
for i := 1 to n do
begin
read(growth);
if (growth < 0) then
begin
growth_boys := growth_boys - growth;
count_boys := count_boys + 1;
end
else
begin
growth_girls := growth_girls + growth;
count_girls := count_girls + 1;
end;
end;
if (count_boys = 0) then
writeln('В классе нет мальчиков')
else
writeln('Средний рост мальчиков: ', (growth_boys / count_boys):0:2);
if (count_girls = 0) then
writeln('В классе нет девочек')
else
writeln('Средний рост девочек: ', (growth_girls / count_girls):0:2);
end.