a m*n is said to have a saddle point it some entrya[i][j] is the smallest in row and largest in column j.
prog that determine the saddle point if it exist
a m*n is said to have a saddle point it some entrya[i][j] is the smallest in row and largest in column j.
prog that determine the saddle point if it exist
Hi..
Here i have the solution... Just check with it..
Is it required one...?
Code:
#include<stdio.h>
int main()
{
int a[10][10],i,j,m,n,big1,i1,j1;
printf("Enter the matrix range\n");
scanf("%d%d",&m,&n);
printf("Enter the matrix\n");
for(i=1; i<=m; i++)
{
for(j=1; j<=n; j++)
{
scanf("%d",&a[i][j]);
}
}
big1=a[1][1];
for(i=1; i<=m; i++)
{
for(j=2; j<=n; j++)
{
if(big1 < a[i][j])
{
big1=a[i][j];
i1=i;
j1=j;
}
}
}
printf("The saddle point is row=%d and coloumn=%d... And the element is %d \n",i1,j1,big1);
return 0;
}
Comment