C Program to check if a input number is a prime number or not

Problem

Write a program in C to check whether a number is a prime number or not.

How to find if a number is a prime number in C ?

A Prime Number is a number that is divisible by 1 and by itself. Some of the examples of the prime number are 2 , 3 , 5 etc.

Here’s a program in C demonstrating how to find whether the given number is a prime number or not.

C

Output

Abundantcode.com coding sample                                            
Enter a number : 7

7 is a prime number.

Leave Your Comment