#include<stdio.h>
int Prime(int n);
int Accumulate(int n);
int main()
{
int n;
int accum;
printf("请输入一个整数n:\n");
scanf("%d",&n);
accum = Accumulate(n);
printf("%d",accum);
return 0;
}
int Prime(int n)
{
int i;
if(n==0 || n==1)
return 0;
for(i=2;i<n;i++)
if(n%i==0)
return 0;
return 1;
}
int Accumulate(int n)
{
int accum=0;
int i;
for(i=n;i!=0;i--)
{
if(Prime(i)==1)
accum += i;
}
return accum;
}
03-31
3819
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-24
769
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-02
828
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-10