Swift - Write program to Create an array of integers and output all the odd numbers contained within it

Requirements

Write program to Create an array of integers and output all the odd numbers contained within it

Demo

var nums = [1,2,3,4,5,6,7,8,9]
for num in nums {
    if num % 2 == 0 {
        print(num)/*w  w  w.  j  a  va 2s  .co  m*/
    }
}

Result

Related Exercise