by Dinesh Thakur Category: C Programming (Pratical)

This program asks the user to find out the prime number. For this user declare the variables that use to store the value in it. User declare two int variables one of them value assign b=2 and put them on a while condition. While (a>1) then passes to control statement if (a%b==0) then a=a/b else b=b+1 and get the output on screen as result. That will show the output is prime numerical or not.

Problem Statement:

This is C Program to check whether the number is prime or not.

  1. Declaring the variable.
  2. Using conditions as required.
  3. Display result on the screen.

Here is C source code for check out the prime number. Output of this program shown below. 


void main()
    int a,b;
    printf("Enter the no. :");

Write the Program For Prime Numbers?

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.