Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = [10, 0, 7, 8, 5, 4, 2, 1, 3, 6, 9]
- swp = 100
- length = a.length - 1
- for i in 0.upto(a.length - 1)
- for j in 0.upto(a.length - 1)
- if a[i] > a[j]
- swp = a[i]
- a[i] = a[j]
- a[j] = swp
- end
- j += 1
- end
- i += 1
- end
- puts a
Add Comment
Please, Sign In to add comment