Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

who to c programing of prime number

0 votes
asked May 1, 2018 by Arup Singh (140 points)

1 Answer

0 votes
answered May 1, 2018 by jahurul25 (140 points)
#include <stdio.h>

int main()
{
    printf("Enter number : ");
    int n,c=0,i;
    scanf("%d",&n);
    
    for(i = 2; i<=n/2; i++)
    {
        if(n % i == 0)
        {
            c = 1;
            break;
        }
    }
    
    if(c==0)
        printf("%d is prime number",n);
    else
         printf("%d is not prime number",n);

    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...