Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Untitled
SUBMITTED BY:
Guest
DATE:
May 10, 2015, 4:46 p.m.
FORMAT:
Text only
SIZE:
475 Bytes
Raw
Download
Tweet
HITS:
949
Go to comments
Report
VD : Kiểm tra một số có phải là nguyên tố hay không
VAR x:LONGINT;
FUNCTION Ngto(x:INTEGER):BOOLEAN;
VAR j: INTEGER;
BEGIN
Ngto:=TRUE;
IF x <=1 THEN Ngto:=FALSE ELSE
FOR j:=2 TO Trunc(Sqrt(x)) DO
IF x MOD j = 0 THEN BEGIN
Ngto:=FALSE; exit; END;
END;
BEGIN
Readln(x);
IF ngto(x) THEN Write(' La so nguyen to') ELSE write(' KHong phai nguyen to ') ; readln;
END.
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus