二维数组的简单运用
程序员文章站
2022-07-15 08:36:21
...
#include <stdio.h>
void main()
{
int i, j, n=3, m=8;
float average = 0.0;
int a[][8] = {{78,75,65,87,89,97,89,92},{98,91,96,89,78,87,88,86},{87,82,85,86,78,67,91,89}};
printf("the average of there courses is: \n");
for(i = 0; i <n; i++)
{
average=0.0;
for(j = 0; j < m; j++)
{
average += a[i][j];
}
printf("%7.1f",average);
}
printf("\n");
}
转载于:https://my.oschina.net/u/241930/blog/400783