/* c code to find prime number in a given range*/
#include<stdio.h>
main()
{
int i,num,deep;
int min,max;
printf("enter the min number");
scanf("%d",&min);
printf("enter the max number");
scanf("%d",&max);
printf("the prime number in a given range is :");
for(num=min;num<=max;num++)
{
deep=num;
for(i=2;i<deep;i++)
{
if(deep%i==0)
{
break;
}
}
if(num==i)
{
printf("%d\n",num);
}
}
}
No comments:
Post a Comment