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],/*from w ww.  j av  a  2  s .  c o m*/
    {
        (maxNum: Int, num: Int) -> Int in
        return max (maxNum, num)
    }
)
print(biggestNumber)  //8

Result

Related Exercise