#include<stdio.h>
int main()
{
int i,m, n,sum=0,j,e,f,c;
printf("输入m,n:");
scanf_s("%d %d", &m,&n);
int arr[80];
for (i=0,j=1;i<=(m-1)*n,j<=m*n-1;i+=2,j+=2)
{
scanf_s("%d %d", &arr[i],&arr[j]);
}
for (e=0,c=0;e<=m; e++,c++)
{
for (f=0;f<=1;f++,c++)
{
sum = sum + arr[c];
}
printf("%d", sum);
sum=0;
}
return 0;
}
第二个循环有问题但是看不出来,谢谢大家指点!┭┮﹏┭┮