Пример теста:
1234 — да: 1+4=2+3
7459 — нет: 7+9 ≠ 4+5
var n,p1,p2,p3,p4:integer;
begin
writeln('введите четырехзначное число');
readln(n);
p1:=n div 1000;
p4:=n mod 10;
p2:=(n div 100) mod 10;
p3:=(n div 10) mod 10;
if p1+p4=p2+p3 then writeln('right') else writeln('false');
readln;
end.
Free Pascal
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
Linking a.out
10 lines compiled, 0.2 sec
/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
введите четырехзначное число
1234
right