#include <stdio.h> int main() { float a[5][5], k = 0, q = 1; int i, j, n;
printf("请输入5x5矩阵中的元素\n"); for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) {
scanf("%f", &a[i][j]); } } for (i = 0, j = 0, n = 4; i < 5 && j < 5 && n >= 0;
i++, j++, n--) { k = k + a[i][j] + a[i][n]; } k -= a[2][2];
printf("两条对角线上的各元素之和为%f\n", k); for (i = 0, j = 0; i < 5 && j < 5; i += 2, j +=
2) { q = q * a[i][j]; } for (i = 0, j = 4; i < 5 && j >= 0; i += 4, j -= 4) { q
= q * a[i][j]; } printf("两条对角线上行、列下标均为偶数的各元素之积为%f\n", q); return 0; }