Thursday, February 2, 2012

Check given number is prime number or not using c program

Definition
of prime number:




A
natural number greater than one has not any other divisors except 1 and itself.
In other word we can say which has only two divisors 1 and number itself. For
example: 5



Their
divisors are 1 and 5.







Note: 2
is only even prime number.







Logic for
prime number in c



We will
take a loop and divide number from 2 to number/2. If the number is not

No comments:

Post a Comment