//this is a program to find whether the entered number is prime or not
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,flag=0;
printf("\n\nEnter any number: ");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i==0)
{
flag=1;
break;
}
}
if (flag==0)
printf("\n\nThe entered number %d is a Prime Number",n);
else
printf("\n\nThe entered number %d is not a Prime Number",n);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,flag=0;
printf("\n\nEnter any number: ");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i==0)
{
flag=1;
break;
}
}
if (flag==0)
printf("\n\nThe entered number %d is a Prime Number",n);
else
printf("\n\nThe entered number %d is not a Prime Number",n);
getch();
}