#include<stdio.h>
int prime(int);
int main(void)
{
int num,i;
printf(“input a positive number:”);
scanf(“%d”,&num);
printf(“all the primes<=%d:\n”,num);
for(i=2;i<=num;i++)
if(prime(i))
printf(“%d\t”,i);
printf(“\n”);
return 0;
}
int prime(int n)
{
int div;
for(div=2;div*div<=n;div++)
if(n%div==0)
return 0;
return 1;
}