program raznost;
var i,s,n,m:integer;
a: array [1..15000] of integer;
begin
readln(n);
for i:=1 to n do
readln (a[i]);
s:=0; m:=0;
for i:=1 to n-1 do begin
s:=abs(a[i]-a[i+1]);
if s>m then
m:=s;
end;
writeln ('Maksimalnaya raznost` ravna ',m);
end.
Объяснение:
program raznost;
var i,s,n,m:integer;
a: array [1..15000] of integer;
begin
readln(n);
for i:=1 to n do
readln (a[i]);
s:=0; m:=0;
for i:=1 to n-1 do begin
s:=abs(a[i]-a[i+1]);
if s>m then
m:=s;
end;
writeln ('Maksimalnaya raznost` ravna ',m);
end.
Объяснение: