R

Ravina • 2.56K Points
Extraordinary

Q. What will this code print?

Code:
let x = 4.5
let y = 2
print(x * Double(y))
  • (A) 9.0
  • (B) 9
  • (C) 6.5
  • (D) Error
  • Correct Answer - Option(A)
  • Views: 1
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Ravina
The integer `y` is converted to `Double`, and 4.5 * 2.0 equals 9.0.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.