Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. //---------------------------------------------------------------------------
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <stdlib.h>
  5. #define N 10
  6.  
  7. //#pragma hdrstop
  8.  
  9. //---------------------------------------------------------------------------
  10.  
  11. //#pragma argsused
  12. main()
  13. {
  14.     int arre[N], arre2[N], arre3[N],i=0, cont=0, j=0,k=0, x;
  15.     clrscr();
  16.     randomize();
  17.     printf("los numeros a ordenar son: \n");
  18.     for(i=0; i<N; i++)
  19.     {
  20.         arre[i] = random(100);
  21.         printf("%d\n",arre[i]);
  22.     }
  23.     while(cont < 10)
  24.     {
  25.         for(i=0; i<N; i++)
  26.         {
  27.             x = ((arre[i])/10);
  28.             if(cont == x)
  29.             {
  30.                 arre2[j] = arre[i];
  31.                 j++;
  32.             }
  33.         }
  34.         cont++;
  35.     }
  36.     cont = 1;
  37.     while(cont < 100)
  38.     {
  39.         for(j=0; j<N; j++)
  40.         {
  41.             if(cont == arre2[j])
  42.             {
  43.                 arre3[k] = arre2[j];
  44.                 k++;
  45.             }
  46.         }
  47.         cont++;
  48.     }
  49.     printf("Los numeros ordenados son \n");
  50.     for(k=0; k<N; k++)
  51.         printf("%d\n",arre3[k]);
  52.     getch();
  53.     return 0;
  54. }
  55. //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement