C Program to identify the number is prime or not.

 CODE:-

#include<stdio.h>

#include<conio.h>

void main()

{

int num,i,rem;

int flag=0;

printf("Enter the number=");

scanf("%d",&num);

for(i=2;i<num;i++)

{

    rem=num%i;

    if(rem==0)

    {

        flag=1;

        break;

    }

    else

    continue;

    

}

if(flag==1)

printf("%d is not prime number.",num);

else

printf("%d is prime number.",num);

}

Comments

Popular posts from this blog

Tips to improve Coding Skill