Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <stdio.h>
int main(){
int liste[] = {6, 4, 7, 5, 3};
int laenge = 5;
int i, j, tauschwert;
for (i = 0; i < laenge - 1; i++){
for (j = 0; j < laenge - i - 1; j++){
if (liste[j] > liste[j + 1]){
tauschwert = liste[j];
liste[j] = liste[j + 1];
liste[j + 1] = tauschwert;
}
}
printf("Durchgang %i: ", i + 1);
for (j = 0; j < laenge; j++){
printf("%i ", liste[j]);
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.