Advertisement
Mastercpp

Untitled

Sep 1st, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main(){
  6.    
  7.     int numeros [4][4];
  8.     int mayor=0;
  9.  
  10.     for(int i = 0; i<4; i++){
  11.         for(int j =0; j<4; j++){
  12.             printf("ingrese un numero para  la posicion [%i][%i] : ",i,j);
  13.             scanf("%i",&numeros[i][j]);
  14.         }
  15.     }
  16.    
  17.  
  18.  
  19.  
  20.     /* mostrando  lo arreglos
  21.     printf("\t\tMostrando Arreglos ");
  22.         for(int i = 0; i<4; i++){
  23.             for(int j =0; j<4; j++){
  24.                 printf("numeros[%i][%i] = %i \n",i,j,numeros[i][j]);
  25.             }
  26.     }*/
  27.  
  28.      for(int i=0; i<4; i++)
  29.      {
  30.         for(int j=0; j<4; j++)
  31.         {
  32.             for(int x=0; x<4;x++)
  33.             {
  34.                 for(int y=0; y<4; y++)
  35.                 {
  36.                     if(numeros[i][j]>numeros[x][y])
  37.                     {
  38.                         mayor=numeros[i][j];
  39.                         numeros[i][j]=numeros[x][y];
  40.                         numeros[x][y]=mayor;
  41.                     }
  42.  
  43.                 }
  44.             }
  45.          }
  46.     }
  47.     printf("\t\tMostrando Arreglos ");
  48.         for(int i = 0; i<4; i++){
  49.             for(int j =0; j<4; j++){
  50.                 printf("%i\n",numeros[i][j]);
  51.             }
  52.         }
  53.        
  54.     system("pause"); // esta es un funcion de la libreria stdlib.h  
  55.     return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement