Var n,i,k:integer; function prost(n:integer):boolean; var j,m:integer; begin m:=0; for j:=2 to trunc(sqrt(n)) do if n mod j = 0 then inc(m); prost:=m=0; end; begin readln(n); k:=0; if n mod 2<>0 then writeln('Ошибка ввода') else begin for i:=2 to n div 2 do if prost(i)and(prost(n-i)) then begin writeln(n,' = ',i,'+',n-i); k:=k+1; end; if k=0 then writeln('Увы!'); end; end.
Answers & Comments
Verified answer
Var n,i,k:integer;function prost(n:integer):boolean;
var j,m:integer;
begin
m:=0;
for j:=2 to trunc(sqrt(n)) do
if n mod j = 0 then inc(m);
prost:=m=0;
end;
begin
readln(n);
k:=0;
if n mod 2<>0 then writeln('Ошибка ввода')
else begin
for i:=2 to n div 2 do
if prost(i)and(prost(n-i)) then
begin writeln(n,' = ',i,'+',n-i); k:=k+1; end;
if k=0 then writeln('Увы!');
end;
end.
Пример:
98
98 = 19+79
98 = 31+67
98 = 37+61