Prime Number with break
#include<stdio.h>
void main()
{
int num,i,flag=0;
printf("Enter The Number:");
scanf("%d",&num);
for(i=2;i<=num/2;i++)
{
if(num%i==0)
{
flag=1;
break;
}
}
if(flag==0)
printf("%d Number is Prime",num);
else
printf("%d Number is Not Prime",num);
}
void main()
{
int num,i,flag=0;
printf("Enter The Number:");
scanf("%d",&num);
for(i=2;i<=num/2;i++)
{
if(num%i==0)
{
flag=1;
break;
}
}
if(flag==0)
printf("%d Number is Prime",num);
else
printf("%d Number is Not Prime",num);
}
Comments
Post a Comment