2个回答
展开全部
//#include <Windows.h>
#include <stdio.h>
#define ARRAY_SIZE 5
float array_num[ARRAY_SIZE][ARRAY_SIZE] = {
{1, 2, 3, 4, 5},
{6, 7, 8, 9, 10},
{11, 12, 13, 14, 15},
{16, 17, 18, 19, 20},
{21, 22, 23, 24, 25},
};
int main(int argc, char *argv[])
{
int i = 0;
int j = 0;
float sum = 0;
for(i = 0; i < ARRAY_SIZE; i++)
{
for(j = 0; j < ARRAY_SIZE; j++)
{
if(i == j || i+j == ARRAY_SIZE-1)
{
sum += array_num[i][j];
}
}
}
printf("sum = %f\n", sum);
//system("pause");
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询