/*从键盘获取一个数num,求所有小于num的质数的个数,请完成下面daima
*/
#include
int is_primer(int num)
{
int flag=1;
int a;
for(a=2;a {
if(num%a==0)
{
flag=0;
continue;
}
}
return flag;
}
int primer_number(int num)
{
int count=0;
int i;
if(num==1)
return 0;
for(i=2;i {
if(is_primer(i)==1)
count++;
}
return count;
}
int main()
{
int num;
scanf("%d",&num);
printf("%d以内的质数的个数是%d个\n",num,primer_number(num));
}