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
Bucles: Suma de n números tecleados hasta introducir 0
Comprueba si orden creciente
Hello world
Bucles: Euclides
C
fun kce
Herout (67) - 11
marquee text in C
Roots of a Quadratic Equation
Ducktype