#include<stdio.h>
int main()
{
int i,j,a,b,m=0;
printf("Enter the range:");
scanf("%d%d",&a,&b);
for(i=a;i<=b;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
break;
}
if(j==i)
{
printf("%d\t",i);
m++;
}
}
printf("\nThe total no.of prime numbers is %d.",m);
return 0;
}
No comments:
Post a Comment