var a: array [1..100] of integer;
i,max,min: integer;
begin
for i:= 1 to 100 do
a[i]:= random(50)-25;
write(a[i]:5);
end;
min:= a[1];
max:= a[1];
if a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
writeln;
writeln('min = ',min);
writeln('max = ',max);
writeln('min + max = ',min + max);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var a: array [1..100] of integer;
i,max,min: integer;
begin
for i:= 1 to 100 do
begin
a[i]:= random(50)-25;
write(a[i]:5);
end;
min:= a[1];
max:= a[1];
for i:= 1 to 100 do
begin
if a[i] > max then max:=a[i];
end;
for i:= 1 to 100 do
begin
if a[i] < min then min:=a[i];
end;
writeln;
writeln('min = ',min);
writeln('max = ',max);
writeln('min + max = ',min + max);
end.