#include
int IsPrime(int i);
int main()
{
int n,i;
int sum = 0;
int prime = 0;
do{
printf("please input a number:");
scanf("%d",&n);
if(IsPrime(n)!=-1)
{
prime = IsPrime(n);
sum += prime;
}
}while(n >= 1);
printf("the sum is:%d\n",sum);
return 0;
}
int IsPrime(int i)
{
int j,b;
for (j=2;j {
b = i % j;
if (b != 0) continue;
else break;
}
if(j==i) return i;
else return -1;
}
你sum是用来求和的?
啊
dgs