uses crt; var t2,n:word; function snt(x:word):boolean; var t1:word; begin snt:=true; if x<2 then exit(false) else for t1:=2 to round(sqrt(x)) do if x mod t1=0 then exit(false); end; BEGIN clrscr; write(‘Nhap n:’); readln(n); write(‘N=’); for t2:=2 to n div 2 do if (snt(t2)) and (snt(n-t2)) then begin write(t2,’+’,n-t2); break; end; readln END.
program tongnguyento;
uses crt;
var n,i:integer;
function ktnt(k:integer):boolean;
var l:integer;
begin
ktnt:=false;
if k<2 then exit;
for l:=2 to trunc(sqrt(k)) do
if k mod l=0 then exit;
ktnt:=true;
end;
begin
clrscr;
write(‘Nhap n: ‘); readln(n);
for i:=2 to n div 2 do
if ktnt(i) and (ktnt(n-i)) then writeln(n,’= ‘,i,’+’,n-i);
readln
end.
uses crt;
var t2,n:word;
function snt(x:word):boolean;
var t1:word;
begin
snt:=true;
if x<2 then exit(false) else
for t1:=2 to round(sqrt(x)) do
if x mod t1=0 then exit(false);
end;
BEGIN
clrscr;
write(‘Nhap n:’); readln(n);
write(‘N=’);
for t2:=2 to n div 2 do
if (snt(t2)) and (snt(n-t2)) then
begin
write(t2,’+’,n-t2);
break;
end;
readln
END.
Chúc bạn học tốt.
Cho mình xin câu trả lời hay nhất.