2024-11-30 04:17:57
#include <stdio.h>
int main()
{
float arr[3][4]={1,2,3,4,5,6,7,8,9,10,11,12};
float sum[3] = {0};
printf("数组元素:\n");
for (int i = 0; i < 3; ++i)
{
float count = 0;
for(int j = 0;j<4;j++){
printf("%.2f\t", arr[i][j]);
count+=arr[i][j];
}
printf("\n");
sum[i] = count/4;
}
printf("每行平均值:\n");
for (int i = 0; i < 3; ++i)
{
printf("%.2f\t",sum[i] );
}
return 0;
}