Skip to content

Instantly share code, notes, and snippets.

@idoushiki
Last active July 24, 2017 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idoushiki/01c2a92741dd4c69d9b8ed0c6a3534c4 to your computer and use it in GitHub Desktop.
Save idoushiki/01c2a92741dd4c69d9b8ed0c6a3534c4 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void){
int i,j,w,aa,fl=0;
int a[]={4,2,7,41,98,9,3,222,1,11};
for(i=0;i<=9;i++){
for(j=9;j>=i+1;j--){
fl=0;
if(a[j-1]>a[j]){
w=a[j-1];
a[j-1]=a[j];
a[j]=w;
fl=1;
}
for(aa=0;aa<=9;aa++){
printf("%d ",a[aa]);
if(aa>=9)printf("\n");
}
}
if(fl==0)break;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment