var n,k,i, max, sum, min: integer; a: array [1..100] of integer; begin writeln ('vvedi n'); read (n); writeln (n); k:=0; for i:=1 to n do read (a[i]); max:=a[1]; min:=a[1]; for i:=1 to n do begin if a[i]<min then min:=a[i] ; if a[i]>max then max:=a[i] ; end; sum:=min+max; writeln ('sum=',sum); end.
var
n,k,i, max, sum, min: integer;
a: array [1..100] of integer;
begin
writeln ('vvedi n');
read (n);
writeln (n);
k:=0;
for i:=1 to n do
read (a[i]);
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if a[i]<min then min:=a[i] ;
if a[i]>max then max:=a[i] ;
end;
sum:=min+max;
writeln ('sum=',sum);
end.