1、
#include <stdio.h>
int main(void)
{
int i, j, a[6][2];
for(i = 0; i < 6; i++)
{
for(j = 0; j < 2; j++)
{
printf("a[%d][%d] = ", i, j); scanf("%d", &a[i][j]);
}
}
puts("show the matrix form of 6 row 2 col array.");
for(i = 0; i < 6; i++)
{
for(j = 0; j < 2; j++)
{
printf("%4d", a[i][j]);
}
putchar('\n');
}
int sumchi = 0, summath =0;
for(i = 0; i < 6; i++)
{
for(j = 0; j < 2; j++)
{
if( j == 0)
sumchi += a[i][j];
else
summath += a[i][j];
}
}
printf("sumchi = %d\n", sumchi);
printf("summath = %d\n", summath);
int c[6]= {0};
for(i = 0; i < 6; i++)
{
for(j = 0; j < 2; j++)
{
c[i] += a[i][j];
}
}
for(i = 0; i < 6; i++)
{
printf("the sum = %d the mean = %.2f\n", c[i], (double)c[i] / 2);
}
return 0;
}