

Tại sao khi mình chạy chương trình thì nó lại báo là exitcode = 2 vậy mọi người? Code chi tiết bên dưới:
const
fi_name = 'SUPERPRIME.INP';
fo_name = 'SUPERPRIME.OUT';
var
i,n,demus:LongInt;
fi,fo: text;
begin
assign(fi,fi_name);
reset(fi);
read(fi,n);
close(fi);
assign(fo,fo_name);
rewrite(fo);
while(n>0)do
begin
demus:=0;
for i:=1 to n do if(n mod i =0)then inc(demus);
if(demus<>2)then
begin
write(fo,'NO');
exit;
end;
n:= n div 2;
end;
write(fo,'YES');
close(fo);
end.
Vậy mình sai chỗ não vậy? Mong các cao nhân chỉ giáo ^^

const
fi_name = 'SUPERPRIME.INP';
fo_name = 'SUPERPRIME.OUT';
var
i,n,demus:LongInt;
fi,fo: text;
begin
assign(fi,fi_name);
reset(fi);
read(fi,n);
close(fi);
assign(fo,fo_name);
rewrite(fo);
while(n>0)do
begin
demus:=0;
for i:=1 to n do if(n mod i =0)then inc(demus);
if(demus<>2)then
begin
write(fo,'NO');
exit;
end;
n:= n div 2;
end;
write(fo,'YES');
close(fo);
end.
Vậy mình sai chỗ não vậy? Mong các cao nhân chỉ giáo ^^


