Swift - Write program to to find out the largest number from the array

Requirements

Write program to to find out the largest number from the array

Hint

Demo

var numbers = [5,6,3,2,4,8,1,0]
var biggestNumber = numbers.reduce(
    numbers [0],// www .ja v a 2  s  . c om
    {
        (maxNum: Int, num: Int) -> Int in
        return max (maxNum, num)
    }
)
print(biggestNumber)  //8

Result

Related Exercise