Search This Blog

Showing posts with label c program to check prime number. Show all posts
Showing posts with label c program to check prime number. Show all posts

Program to Check Whether a Number is Prime or Not

This is a c program to check whether a given number is prime or not. To check whether a number 'n' is prime or not, it is enough to check whether it is divisible by any number less than or equal to square root of n. If there is any number i less than or equal to square root of n which divides n completely, then it is not prime. Otherwise it is prime.