program kiemtra;
uses crt;
var M: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;
function ktcp(k:integer):boolean;
begin
if sqr(trunc(sqrt(k))=k then ktcp:=true
else ktcp:=false;
end;
function kthh(k:integer):boolean;
var l,t:integer;
begin
t:=0;
for l:=1 to k div 2 do
if k mod l=0 then t:=t+l;
if t=k then kthh:=true else kthh:=false;
end;
BEGIN
clrscr;
write('Nhap M: '); readln(m);
if ktnt(m) then writeln(m,' la so nguyen to')
else writeln(m,' khong phai so nguyen to');
if ktcp(m) then writeln(m,' la so chinh phuong')
else writeln(m,' khong phai so chinh phuong');
if kthh(m) then write(m,' la so hoan hao')
else write(m,' khong phai so hoan hao');
readln;
end.