Colocar Elementos en La Diagonales

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

void OrdenarMatriz(int matriz[][MAX], int fil, int col){

int i, j, x, y,mayor;
for(i=0;i<fil;i++){
for(j=0;j<col;j++){
for(x=0;x<fil;x++){
for(y=0;y<col;y++){
if(matriz[i][j]>matriz[x][y]){
mayor = matriz[i][j];
matriz[i][j] = matriz[x][y];
matriz[x][y] = mayor;
}
}
}
}
}
}

void GuardarMatriz(int x[][MAX], int n, int c[]){


int k=0,i,j;
while(k<(2*n)){
for(i=0;i<n;i++){
for(j=0;j<n;j++){
c[k]=x[i][j];
k++;
}
}
}
}
void ColocarMatriz(int x[][MAX],int n, int c[]){
int i,j,k=0;
while(k<n){
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if (i == j){
x[i][j] = c[k];
k++;
}
}
}
}
}
void colocarMatriz(int x[][MAX],int n, int c[]){
int i,j,k = n ;
while(k<(2*n)){
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(i+j == n-1){
x[i][j] = c[k];
k++;
}
}
}
}
}

You might also like