 |
Prime number in C |
#include<stdio.h>
int main()
{
int n,i,state = 0;
printf("\nEnter the number n :");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i !=0)
continue;
else
{
state = 1;
printf("\nEntered number is not a prime");
break;
}
}
if (state ==0)
{
printf("\nEntered Number is Prime");
}
return 0;
}
No comments:
Post a Comment