Auto commit
This commit is contained in:
parent
dcf8569b07
commit
5b4d574902
25
2207/C语言同步练习源码/3.数组-5.c
Normal file
25
2207/C语言同步练习源码/3.数组-5.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
@ -568,7 +568,9 @@ int main(){
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
```c
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user