Guest User

Untitled

a guest
Dec 11th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. a = [10, 0, 7, 8, 5, 4, 2, 1, 3, 6, 9]
  2. swp = 100
  3. length = a.length - 1
  4.  
  5. for i in 0.upto(a.length - 1)
  6. for j in 0.upto(a.length - 1)
  7. if a[i] > a[j]
  8. swp = a[i]
  9. a[i] = a[j]
  10. a[j] = swp
  11. end
  12. j += 1
  13. end
  14. i += 1
  15. end
  16. puts a
Add Comment
Please, Sign In to add comment