-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSaddle Point
More file actions
52 lines (46 loc) · 913 Bytes
/
Saddle Point
File metadata and controls
52 lines (46 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<stdio.h>
int main()
{
int i , j ,s , p ,h=0,k, arr[10][10],n;
printf("Enter the size of the matrix:- ");
scanf("\n%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("Enter values:-");
scanf("\n%d",&arr[i][j]);
}
}
printf("Given Matrix\n");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",arr[i][j]);
}
printf("\n");
}
for(i=0;i<n;i++)
{
s=arr[i][0];
p=0;
for(j=1;j<n;j++)
{
if(arr[i][j]<s)
{
s =arr[i][j];
p=j;
}
}
for(k=0;k<n;k++)
{
if(s>=arr[k][p])
h=s;
else
break;
}
}
if(h==s)
printf("Saddle point element is %d",h);
}