标签:style print 平均值 for += std printf col return
#include<stdio.h> int main() { int buf[3][5] ={{1,2,3,4,5},{4,5,6,7,8},{7,8,9,10,11}}; int i; int j; //求行平均值 for(i = 0; i < 3; i++) { int sum = 0; for(j = 0; j < 5; j++) { sum += (*(*(buf + i) + j)); } printf("sum = %d\n",sum/5); } //求列平均值 for(i = 0; i < 5; i++) { int sum = 0; for(j = 0; j < 3; j++) { sum += (*(*(buf + j) + i)); } printf("sum = %d\n",sum/3); } return 0; }
标签:style print 平均值 for += std printf col return
原文地址:https://www.cnblogs.com/wanghao-boke/p/11020386.html