void nhapmt2chieu(int a[10][10],int n,int m)
{
printf("Nhap ma tran 2 chieu:
");
int i =0;
int j =0;
for(i = 0; i < n; i++)
{
for(j = 0; j < m; j ++)
{
printf("a[%d][%d] = ", i,j);
scanf("%d",&a[i][j]);
}
printf("
");
}
}
void xuatmt2chieu(int a[10][10], int n, int m)
{
printf("Nhap ma tran 2 chieu:
");
int i =0;
int j =0;
for(i = 0; i < n; i++)
{
for(j = 0; j < m; j ++)
{
printf("%5d",a[i][j]);
}
printf("
");
}
}
....................................
void xuatmt_tamgiactren(int a[10][10], int n, int m)
{
printf("Nhap ma tran 2 chieu:
");
int i =0;
int j =0;
int tam;
tam = 0;
for(i = 0; i < n; i++)
{
for(tam = 0; tam < i; tam ++)
{
printf(" ");
}
for(j = i; j < m; j ++)
{
{
printf("%5d",a[i][j]);
}
}
printf("
");
}
}
......................................
int min_mt2chieu(int a[10][10], int n,int m)
{
int i;
i = 0;
int j;
j = 0;
int temp;
temp = a[0][0];
for(i = 0; i <n; i++)
{
for(j = 0; j < m; j++)
{
if(a[i][j] < temp)
{
temp = a[i][j];
}
}
}
return temp;
}
.....................................
int uscln_mt2chieu(int a[10][10], int n, int m)
{
int i =0;
int temp;
for(i = 0; i < n; i++)
{
temp = uoc_max(a[i],m);
}
return temp;
}
.........................................
int min_tamgiactren(int a[10][10], int n,int m)
{
int i;
i = 0;
int j;
j = 0;
int temp;
temp = a[0][0];
for(i = 0; i <n; i++)
{
for(j = i; j < m; j++)
{
if(a[i][j] < temp)
{
temp = a[i][j];
}
}
}
return temp;
}
..........................................
int uoc_max_tamgiactren(int a[10][10], int n,int m)
{
int i;
int temp = min_tamgiactren(a, n,m);
//printf("
i = %d", i);
int j ;
//int dem = 0;
int k;
while( temp>=1)
{
j = 0;
i = 0;
//dem = 0;
for(i = 0; i < n; i++)
{
for(j = i; j < m; j ++)
{
if(a[i][j] % temp != 0)
{
break;
}
}
}
if(i ==n && j == m)
{
break;
}
temp = temp -1;
}
return temp;
}