Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Vectores: Burbuja
#include <stdio.h> #include <stdlib.h> #define TAM 100 int main() { int a[TAM], tmp, p, i; srand(time(NULL)); for (i=0; i<TAM; i++) a[i]= rand()%TAM; for (i=0; i<TAM; i++) printf("%d, ", a[i]); for (p = 0; p < TAM-1; p++ ){ for (i = 0; i < TAM-p-1; i++){ if (a[i] > a[i+1]){ tmp= a[i]; a[i] = a[i+1]; a[i+1] = tmp; } } } printf("\n\n----------------------------------------------\n\n"); for (i=0; i<TAM; i++) printf("%d, ", a[i]); return 0; }
run
|
edit
|
history
|
help
0
Día de la semana
Vectores: Llena vector con números al azar
Bucles: Triángulo de asteriscos lateral izquierdo
Roots of a Quadratic Equation
Find the length of largest subarray with equal number of 0's and 1's using recursion
Max number of a vector
mallocpole
0001
Printf ejemplos varios
Punteros: strlen