Can any one help me with this code?
hi to all
please can u help me to find the problems in this program
this program will find the min element in quarter1 of square array and the max element of quarter3 and replace them
q1 , q2
q4 , q3
thank u
please can u help me to find the problems in this program
this program will find the min element in quarter1 of square array and the max element of quarter3 and replace them
q1 , q2
q4 , q3
#include<stdio.h>
main()
{
int a[10][10],i,j,min,max,lmin,lmax,n,m ;
scanf("%d",&n) ;
scanf("%d",&m) ;
for (i=0;i<n;i++)
for (j=0;j<m;j++)
scanf("%d",&a[i][j]) ;
for(i=0;i<n/2;i++)
for(j=0;j<m/2;j++)
min = a[i][j] ;
for(i=0;i<n/2;i++)
for(j=0;j<m/2;j++)
if ( min > a[i][j] )
a[i][j]=min ;
lmin=a[i][j] ;
for(i=n/2;i<n;i++)
for(j=m/2;j<m;j++)
max = a[n/2][m/2] ;
for(i=n/2;i<n;i++)
for(j=m/2;j<m;j++)
if ( max < a[i][j] )
{
a[i][j] = max ;
lmax=a[i][j] ;
}
a[i][j] = lmax;
lmax = lmin ;
lmin = a[i][j] ;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
printf("%d",a[i][j] ) ;
printf("\n") ;
}
} thank u
0