const
n=7;
var
a:array [1..n] of integer;
i,k,buf:integer;
begin
for i:=1 to n do begin
write ('A[',i,'] = ');readln(a[i]);
if a[i]=49 then k:=i;
end;
writeln ('Before:');
for i:=1 to n do write(a[i],' ');
writeln;
writeln ('Index: ',k):
buf:=a[1];
a[1]:=a[k];
a[k]:=buf;
writeln ('After: ');
for i:=1 to n do write (a[i],' ');
readln;
end.
const
n=7;
var
a:array [1..n] of integer;
i,k,buf:integer;
begin
for i:=1 to n do begin
write ('A[',i,'] = ');readln(a[i]);
if a[i]=49 then k:=i;
end;
writeln ('Before:');
for i:=1 to n do write(a[i],' ');
writeln;
writeln ('Index: ',k):
buf:=a[1];
a[1]:=a[k];
a[k]:=buf;
writeln ('After: ');
for i:=1 to n do write (a[i],' ');
readln;
end.