Tux Education Our New Education Channel Please Share And Subscribe It...

/* Check Given Number Is Prime Number Or Not */

// Compiler : Dev C++4.9.9.2

#include<stdio.h>

int main()
{
    int num,i,count=0;
    
    printf("Number : ");
    scanf("%d",&num);
    
    for(i=2; i<num; i++)
    {
             if(num%i==0)
             {
                         count++;
                         break;
             }
    }
    
    if(count==0 && num!=1)
    printf("\n\n%d Is Prime Number",num);
    else
    printf("\n\n%d Is Not Prime Number",num);
    
    getch();
    return 0;
}

Post a Comment