Prime number in C: Here we discuss about program for how to check whether number is prime or not.

Prime number in C
C Prime Number Program

In this post we are going to see  c prime number program. in which we will see how to check where given number is prime number or not a prime number through a very simple logic in c prime number program.

Before that for your better understanding we will see what is prime number means-

what is prime number?

"prime number is nothing but the number which can be divisible by only '1' and 'itself number' only."

means a number which cant be decide  by any other number other than 1 and itself number.

for example: suppose 5 is a number. 5 can be only divisible by 1 and 5, so that it is prime number. take another number 6, 6 can be divisible by 1,2,3 and 6, so that it is not a prime number.
hope you understand logic of prime number. lets see how to write c  prime number program.

c prime number program 


# include<conio.h>

void main()



  int num=0,count=0,i=0;

  printf("Enter any number to check where it is prime or not:");









   printf("Entered Number is a Prime Number");




   printf("Entered Number is Not a Prime Number");





Enter any number to check where it is prime or not: 5

Entered Number is a Prime Number

hope you have understand the prime number program in c. if you have still any concern about it you can fill free to ask in comment box.

Post a Comment

Previous Post Next Post