1.
/*4. Find the saddle point in a two-dimensional array where the element on the line is the largest, smallest on the column, or there may not be a saddle point*/#include<stdio.h>intMain () {intI,j,max,min,row,col,n;//Max the row maximum, min the column minimum, row is the number of rows, col is the number of columns inta[3][4]; printf ("Please enter an array of 3 rows and 4 columns: \ n"); for(i=0;i<3; i++) for(j=0;j<4; j + +) scanf ("%d",&A[i][j]); for(i=0;i<3; i++) { //The line has gone through. Find Maximum value for(j=0;j<4; j + +) {Max=a[i][0]; if(a[i][j]>max) {Max=A[I][J];//maximum value of row i, column Jrow=i; Col=K; Min=a[i][j];} } //the rows are traversed, and the columns continue to traverse to find the minimum value for(n=0;n<3; n++) { if(min>A[n][col]) {min=A[n][col]; Row=N;} } if(row==i) printf ("line%d, column%d, saddle point is%d:\n", row+1, col+1, A[row][col]); } return 0; }
C language _ Help others