Skip to content

get_as_X should return type X#76

Open
tiagokapp wants to merge 1 commit intomasterfrom
z-transfer-fix-1
Open

get_as_X should return type X#76
tiagokapp wants to merge 1 commit intomasterfrom
z-transfer-fix-1

Conversation

@tiagokapp
Copy link

#include<stdio.h>

main(){

int i, j, tamanho;
int vetor[30];
int auxiliar;



printf("digite o tamanho");
scanf("%d",&tamanho);


for (i=0;i<=tamanho;i++){
	
	
	printf("digite um valor vetor[%d] \n \n ", i);
	scanf("%d",&vetor[i]);
}


  for (i=0;i<=tamanho-1;i++){
  	
  		for (j=i+1;j<=tamanho; j++){
  			
  			 if ( vetor[i]>vetor[j]){
  			 	
  			 	
  			 	
  			 	vetor[i] = auxiliar;
				   vetor[i]= vetor[j];
				   vetor[j] = auxiliar;				   
				   
				   

				   
				   
				   
				   }
  			
  			
		  }
  	
  	
  }
        for (i=0;i<=tamanho; i++){
        	
        	printf("\n\n o vetor ordenado eh vetor[%d]", vetor[i]);

	
	
		}	

}

@tiagokapp
Copy link
Author

Ordenação de um vetor feito por algoritmo interativo, o principio da ordenação é simples, mas eficaz, usa-se duas estruturas de repetição para a ordenação, no caso a estrutura for, duas vezes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant