Programming Tutorial (C / Windows/ Prolog)
CLOUD COMPUTING | DATA MINING | ARTIFICIAL INTELLIGENCE | APPLICATION PROGRAMMING IN C/C++/Java
Wednesday, May 4, 2011
PROGRAM TO Check a number is PRIME OR NOT
div(X,A):- N is A*A , N=<X, X mod A =:=0.
div(X,A):- A<X, A1 is A+1,div(X,A1).
check_prime(X):- A is 2, X>1, \+div(X,A).
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment