🙏 아래 포스팅을 참고하여 작성했습니다.
import Foundation
// https://www.acmicpc.net/problem/2438
let N = Int(readLine()!)!
for i in 1...N {
for _ in 0..<i {
print("*", terminator: "")
}
print()
}
import Foundation
// https://www.acmicpc.net/problem/2438
let N = Int(readLine()!)!
var toPrint = ""
for _ in 1...N {
toPrint += "*"
print(toPrint)
}
import Foundation
// https://www.acmicpc.net/problem/2438
let N = Int(readLine()!)!
for i in 1...N {
print(String(repeating: "*", count: i))
}