Description:
Given n integer number, you should print the sum of the prime numbers in the n numbers.
Input
Each test case begin with an integer number n, then n integer numbers
Output
For each case,you should print the sum of the prime number in one line
就是说第一个数输入的是后面有几个数 第二个开始到最后一个,凡是是素数的就求和
Sample Input
2 3 5
5 1 2 3 4 5
Sample Output
8
10
请各位帮我看看我写的代码 本人非专业学生 什么都不懂 这个问题我写出来的一直都是错的 但是我不知道哪里错TAT 求指点
#include<stdio.h>
int main()
{
int n,a,sum,i,j,c;
while((scanf("%d",&n))!=EOF)
{
for(i=1;i<=n;i++)
{
sum=0;
scanf("%d",&a);
if(a<1)
sum+=a;
if(a>1)
{
for(j=2;j<=a/2;j++)
{
if(a%j!=0)
sum+=a;
}
}
}
printf("%d\n",sum);
}
return 0;
}