编程,输入一批整数,先求出其中的偶数和及奇数和,然后输出偶数和与奇数和的差.#include int main(){int a,sum1=0,sum2=0;printf("put data");scanf("%d,&a");for(scanf("%d",&n)!=EOF); if(n%2==0) sum1=sum1+a; else sum2=sum2+
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/26 20:33:47
![编程,输入一批整数,先求出其中的偶数和及奇数和,然后输出偶数和与奇数和的差.#include int main(){int a,sum1=0,sum2=0;printf(](/uploads/image/z/816239-47-9.jpg?t=%E7%BC%96%E7%A8%8B%2C%E8%BE%93%E5%85%A5%E4%B8%80%E6%89%B9%E6%95%B4%E6%95%B0%2C%E5%85%88%E6%B1%82%E5%87%BA%E5%85%B6%E4%B8%AD%E7%9A%84%E5%81%B6%E6%95%B0%E5%92%8C%E5%8F%8A%E5%A5%87%E6%95%B0%E5%92%8C%2C%E7%84%B6%E5%90%8E%E8%BE%93%E5%87%BA%E5%81%B6%E6%95%B0%E5%92%8C%E4%B8%8E%E5%A5%87%E6%95%B0%E5%92%8C%E7%9A%84%E5%B7%AE%EF%BC%8E%23include+int+main%28%29%7Bint+a%2Csum1%3D0%2Csum2%3D0%3Bprintf%28%22put+data%22%29%3Bscanf%28%22%25d%2C%26a%22%29%3Bfor%28scanf%28%22%25d%22%2C%26n%29%21%3DEOF%29%3B+if%28n%252%3D%3D0%29+++sum1%3Dsum1%2Ba%3B+else++sum2%3Dsum2%2B)
编程,输入一批整数,先求出其中的偶数和及奇数和,然后输出偶数和与奇数和的差.#include int main(){int a,sum1=0,sum2=0;printf("put data");scanf("%d,&a");for(scanf("%d",&n)!=EOF); if(n%2==0) sum1=sum1+a; else sum2=sum2+
编程,输入一批整数,先求出其中的偶数和及奇数和,然后输出偶数和与奇数和的差.
#include
int main()
{
int a,sum1=0,sum2=0;
printf("put data");
scanf("%d,&a");
for(scanf("%d",&n)!=EOF);
if(n%2==0)
sum1=sum1+a;
else
sum2=sum2+a;
printf("sum1=%d\nsum2=%d",sum1,sum2 );
return 0;
}
请指点哪里错了!太多改动的给个例子参考一下
编程,输入一批整数,先求出其中的偶数和及奇数和,然后输出偶数和与奇数和的差.#include int main(){int a,sum1=0,sum2=0;printf("put data");scanf("%d,&a");for(scanf("%d",&n)!=EOF); if(n%2==0) sum1=sum1+a; else sum2=sum2+
#include
#include
int main()
{
int a,sum1=0,sum2=0;
printf("put data");
while(scanf("%d",&a)!=0)
{
if(a%2==0)
sum1=sum1+a;
else
sum2=sum2+a;
}
printf("sum1=%d\nsum2=%d",sum1,sum2 );
system("pause");
\x09return 0;
}