0

Dear All,

I got difficulties here related with extracting max and min value from every column in array.

So far i just can extract max-min value at a time by changing column index, stupid approach..eeeh, but i do it just for testing that code could extract right max and min value

for every column. But when i want to automatically got max and min values for every

different column, i got stuck..

Could you help me..please...

```
#include <stdio.h>
#include <io.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
main()
{
float M[3][3]=
{
{0.01, 1.02, 2.05},
{2.01, 0.00, 5.00},
{3.01, 4.00, 0.40}
};
float mx, mn;
int i,j;
for (i=0;i<3;i++)
{
for (j=0; j<1; j++) // Here i changed the column for testing only.
// with j=0 and j<1 i just want to make sure that max = 3.01
// and min = 0.01.
// so when i changed j = 1 and j<2 i got max = 4.00, min 0.00
{
if(i==0)
{mn = M[0][j];}
if (mx < M[i][j])
{mx = M[i][j];}
if (M[i][j] < mn)
{mn= M[i][j];}
}
}
printf("min=%.2f + max=%.2f\n",mn,mx);
system ("pause");
return 0;
}
```

regards,

roy