below is my code and error message I had been thinking of how to correct it but still couldn't, can anyone pls help me, thx I was trying to make a programme that can make a square with numbers out side like this
input:3
output: 1 2 3
8 4
7 6 5
input:4
output:1 2 3 4
12 5
11 6
10 9 8 7
input:1
output:1
var i,n,e1,e2,n2:longint;
begin
readln(n);
n2:=n;
if n2<>1 then;
begin
for i:=1 to n do
begin
write(i:4);
end;
e1:=(n*n-(n-2)*(n-2));
e2:=n+1;
if n>2 then;
begin
for i:=1 to n-2 do
begin
writeln();
write(e1:4,e2:(n-1)*4);
e1:=e1-1;
e2:=e2+1;
end;
end;
writeln();
begin;
for i:=1 to n2 do
begin;
if n2>2 then;
begin;
write(e1:4);
e1:=e1-1;
end
end
end
end
else if n2=1 then;
write('1');
end.
Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling main.pas
main.pas(35,4) Fatal: Syntax error, ";" expected but "ELSE" found
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be `compiled)`