Program so_chinh_phuong;
uses crt;
Var n,x: integer;
BEGIN
clrscr;
write('Nhap so can kiem tra: n = ');
readln(n);
x:=trunc(sqrt(n);
IF sqr(x)=n then write(n,'la so chinh phuong);
ELSE write(n,' khong phai la so chinh phuong.');
readln;
END.
uses crt;
var n:integer;
begin
clrscr;
write('n='); readln(n);
if trunc(sqrt(n))=sqrt(n) then writeln(n,' la so chinh phuong')
else writeln(n,' khong la so chinh phuong'):
readln;
end.
*Hàm kiểm tra số chính phương:
function cp(x: longint): boolean;
begin
cp:=false;
if x<0 then exit;
if x=sqr(trunc(sqrt(x))) then cp:=true;
end;