[2558] A+B - 2
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
let A = Int(readLine()!)
let B = Int(readLine()!)
let C = A!+B!
print(C)
[8393] 합
n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오.
let num = Int(readLine()!)
var total:Int = 0
for i in 1...num!{
total = total + i
}
print(total)
[1000] A+B
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
let num = readLine()!.split(separator: " ").map { Int($0)! }
var sum = 0
for number in num {
sum += number
}
print(sum)