[iOS / Swift] a와 b 출력하기

justdotheg·2024년 1월 17일

문제


풀이

import Foundation

let n = readLine()!.components(separatedBy: [" "]).map { Int($0)! }
let (a, b) = (n[0], n[1])

print("a = \(a)")
print("b = \(b)")

💁🏻‍♂️ 요약

  • String interpolation(문자열 보간)을 활용해 효율적으로 출력할 수 있는가

0개의 댓글