Program MinMax var a: array [1..100] of real var i, nmin, nmax: integer, min, max: real BEGIN for i := 1 to 100 do read a[i]; // вводим массив min := a[1]; max := a[1]; nmin := 0; nmax := 0; for i := 1 to 100 do begin if a[i] = min then nmin := nmin + 1; if a[i] = max then nmax := nmax + 1; if a[i] < min then begin min = a[i]; nmin := 1; end if a[i] > max then begin max = a[i]; nmax := 1; end end; if nmin > nmax then write ('Min') if nmin < nmax then write ('Max') if nmin = nmax then write ('Ravno') END.
const n = 100;
type mas = array[1..n] of byte;
var input: text;
output: text;
a: mas;
count : byte;
i: byte;
sum_1, sum_2 : integer;
n_1, n_2 :byte;
avrg_1, avrg_2 : real;
begin
sum_1 := 0;
sum_2 := 0;
n_1 := 0;
n_2 := 0;
assign(input,'in.txt');
assign(output,'out.txt');
reset(input);
rewrite(output);
write('N : ');
readln(count);
for i:=1 to count do
begin
readln(input,a[i]);
if i mod 2 = 1 then
begin
sum_1 := sum_1 + a[i];
n_1 := n_1 + 1;
end
else
begin
sum_2 := sum_2 + a[i];
n_2 := n_2 + 1;
end
end;
avrg_1 := sum_1 / n_1;
avrg_2 := sum_2 / n_2;
writeln(output,avrg_1);
writeln(output,avrg_2);
close(input);
close(output);
end.
var a: array [1..100] of real
var i, nmin, nmax: integer, min, max: real
BEGIN
for i := 1 to 100 do read a[i]; // вводим массив
min := a[1]; max := a[1]; nmin := 0; nmax := 0;
for i := 1 to 100 do
begin
if a[i] = min then nmin := nmin + 1;
if a[i] = max then nmax := nmax + 1;
if a[i] < min then begin min = a[i]; nmin := 1; end
if a[i] > max then begin max = a[i]; nmax := 1; end
end;
if nmin > nmax then write ('Min')
if nmin < nmax then write ('Max')
if nmin = nmax then write ('Ravno')
END.