第1个回答 推荐于2016-01-30
#include <stdio.h>
int findMax(int t[][3]) {
int i, j, max = t[0][0];
for (i=0; i<3; i++) {
for (j=0; j<3; j++) {
if (max < t[i][j]) max = t[i][j];
}
}
return max;
}
int findMin(int t[][3]) {
int i, j, min = t[0][0];
for (i=0; i<3; i++) {
for (j=0; j<3; j++) {
if (min > t[i][j]) min = t[i][j];
}
}
return min;
}
int main() {
int x, i, j;
int a[3][3];
for (i=0; i<3; i++) {
for (j=0; j<3; j++) {
printf("Input number (%d, %d): ", i + 1, j + 1);
scanf("%d", &x);
a[i][j] = x;
}
}
printf("\nThe max number is %d\n", findMax(a));
printf("The min number is %d\n", findMin(a));
}本回答被提问者采纳