Skip to main content

Prime Number C language Code | Niks banna

Prime Number C language Code 

C language code runs on some text editiors who compile it and run it.

here is the code

copy it all paste on your .c extension file

#include<stdio.h>

void main()
{
    int i,n,t=0;
scanf("%d",&n);
for(i=2;i<n;i++)
{
    if(n%i==0)
    {
        printf("not a prime number");
        t=1;
        break;
    }
}
    if(t==0)
    {
        printf("Prime number");
    }
}


THANKS FOR READING
FOLLOW ME

 

Comments