C Program to Check weather number is prime or not!:
This program is check weather a given number is prime or not. in which we identify any number that is prime or not.
First of all we should know that, what is prime number?
Those number which is divided by 1 and itself only are called prime number.
For Example: 2,3,5,7,11,13,17,19,23..... . these are all numbers divided by 1 and itself only.
<
ALGORITHM:-

step 1 : Start
step 2 : Enter any integer number
step 3 : Calculate the prime number
step 4 : Check either is it prime or not
step 5 : Stop

PROGRAM CODE:-

C PROGRAM TO CHECK NUMBER IS PRIME OR NOT.

#include<stdio.h>
#include<conio.h>

void main()
{
    int num,i = 1, j = 0, k;
    printf("\nEnter a number:");
    scanf("%d", &num);
    for(i = 2; i < num/2; i++)
    {
        if(num % i == 0)
        {
            j = 1;
            break;
        }
    }
    if(j == 0)
    {
        printf("%d is prime number: " ,num);
    }
    else
    {
        printf("%d is not prime number: " ,num);
    }
    getch();
}



C PROGRAM TO DISPLAY PRIME NUMBER BETWEEN 1 TO 100

#include<stdio.h>
#include<conio.h>

void main()
{
    int num,i,count;
  
    for(num = 1;num<=100;num++)
    {
         count = 0;
         for(i=2;i<=num/2;i++)
         {
             if(num%i==0)
             {
                 count++;
                 break;
             }
         }        
         if(count==0 && num!= 1)
         printf("%d ",num);
    }  
    getch();
}

OUTPUT:-

Enter A Number: 29
29 is a prime number

Enter A Number: 6
6 is not prime number


C Progrm to check weather given number is prime or not
How to know that given number is prime number
Prime number in c