Advertisement
CotaIgnorada

bubble

Nov 6th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. void bubble(int a[], int n){
  3. int i=0;
  4. int j=0;
  5. int temp;
  6. for (i=n-1; i>0; i--){
  7. for(j=0; j<=i-1; j++){
  8. if(a[j]>a[j+1]){
  9. temp= a[j];
  10. a[j]= a[j+1];
  11. a[j+1]= temp;
  12. }
  13. }
  14. }
  15. int main (){
  16. int a[]={1,2,3,4,5,6,7};
  17. int n=7;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement