# include <stdio.h>
void main ()
{
int i,sum1,sum2,a[9];
sum1=0;
sum2=0;
for(i=0;i<=8;i++)
{
scanf("%d",&a[i]);
if(i%4==0)
sum1=sum1+a[i];
if(i%2==0 && i>0 && i<8)
sum2=sum2+a[i];
}
for(i=0;i<=8;i++)
{
printf("%d,",a[i]);
if(i%3==2)
printf("\n");
}
printf("sum1=%d\n",sum1);
printf("sum2=%d\n",sum2);
}
昨天晚上电脑出了点故障,今天刚运行程序!
void main ()
{
int i,sum1,sum2,a[9];
sum1=0;
sum2=0;
for(i=0;i<=8;i++)
{
scanf("%d",&a[i]);
if(i%4==0)
sum1=sum1+a[i];
if(i%2==0 && i>0 && i<8)
sum2=sum2+a[i];
}
for(i=0;i<=8;i++)
{
printf("%d,",a[i]);
if(i%3==2)
printf("\n");
}
printf("sum1=%d\n",sum1);
printf("sum2=%d\n",sum2);
}
昨天晚上电脑出了点故障,今天刚运行程序!