首页 > 代码库 > P50

P50

#include<stdio.h>
#include<math.h>
int fun (int high)
{
	int sum=0,n=0,j,yes;
	while((high>=2)&&(n<10))
	{
		yes=1;
		for(j=2;j<=high/2;j++)
			if(high%j==0)
			{
				yes=0;break;
			}
			if(yes)
			{
				sum+=high;
				n++;
			}
			high--;
				}
	return sum;
}
main()
{
	printf("%d\n",fun(100));
}