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)/*from w  ww  .j a va 2  s .  c  o m*/
    }
}

Result

Related Exercise