Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var list = [5, 4, 3, 5, 2, 50, 8, 10, 300]
- func findMin(numbers: NSArray) {
- var minValue = numbers[0]
- var isSmallest: Bool
- for i in 0...numbers.count {
- isSmallest = true
- for j in 0...numbers.count {
- if i > j {
- isSmallest = false
- }
- }
- if isSmallest {
- minValue = i
- }
- }
- print("Smallest value in the list is (minValue)")
- }
- findMin(numbers: list as NSArray)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement