26 lines
488 B
C
26 lines
488 B
C
#include <stdio.h>
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
#include <limits.h> //里面定义了基本数据类型的最大值和最小值
|
|
|
|
int main(){
|
|
int num[3][4], i, j, min=INT_MAX, i_index, j_index;
|
|
srand((unsigned)time(NULL));
|
|
|
|
for(i=0;i<3;i++){
|
|
for(j=0;j<4;j++){
|
|
num[i][j] = rand()%101;
|
|
printf("%2d ", num[i][j]);
|
|
if(num[i][j] < min){
|
|
min = num[i][j];
|
|
i_index = i;
|
|
j_index = j;
|
|
}
|
|
}
|
|
printf("\n");
|
|
}
|
|
printf("min=%d i=%d j=%d\n", min, i_index, j_index);
|
|
return 0;
|
|
}
|
|
|