Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a[]={10,9,8,7,6,5,4,3,2,1};
  8. int sz=10,k=0;;
  9. for (int i=1;i<sz;++i)
  10. {
  11. for (int j=i;j>0;--j)
  12. {
  13. k++;
  14. if (a[j]<a[j-1])
  15. {
  16. int c=a[j];
  17. a[j]=a[j-1];
  18. a[j-1]=c;
  19. }
  20.  
  21. }
  22. }
  23. cout«k;
  24. return 0;
  25. }
  26. number 15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement