Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- // Programa para ordenar una cadena Definida de Numeros
- int main(int argc, char *argv[])
- {
- int i,m;
- int v[9]={1,2,1,9,67,43,65,44,77}; //Cadena de Numeros
- printf("Valores sin ordenar\n");
- for (m=0;m<9;m++){
- printf("%i ",v[m]);
- }
- printf("\nValores Ordenados\n");
- //Usando el Metodo electrónico se ordenan...
- int k,j,aux;
- for ( k=0;k<8-1;k++){
- if ( v[k]>v[k+1]){
- aux=v[k];
- v[k]=v[k+1];
- v[k+1]=aux;
- if(k>0);
- k=k-2;
- }
- }
- for (m=0;m<9;m++){
- printf("%i ",v[m]);
- }
- printf("\n");
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement