python으로만 풀던 문제들을 처음부터 하나씩 swift로 바꿔보자
1000_A+B
a, b = map(int, input().split())
print(a+b)
import Foundation
let line = readLine()!
let lineArr = line.components(separatedBy: " ")
let a = Int(lineArr[0])!
let b = Int(lineArr[1])!
print(a+b)
1001_A-B
a, b = map(int, input().split())
print(a-b)
import Foundation
let line = readLine()!
let lineArr = line.components(separatedBy: " ")
let a = Int(lineArr[0])!
let b = Int(lineArr[1])!
print(a-b)
10998_A*B
a, b = map(int, input().split())
print(a*b)
import Foundation
let line = readLine()!
let lineArr = line.components(separatedBy: " ")
let a = Int(lineArr[0])!
let b = Int(lineArr[1])!
print(a*b)
1008_A/B
a, b = map(float, input().split())
print(a/b)
import Foundation
let inputLine = readLine()!
let inputLineArray = inputLine.components(separatedBy: " ")
let a = Double(inputLineArray[0])!
let b = Double(inputLineArray[1])!
print(a / b)
10869_사칙연산
a, b = map(int, input().split())
print(a+b)
print(a-b)
print(a*b)
print(a//b)
print(a%b)
import Foundation
let inputLine = readLine()!
let inputLineArray = inputLine.components(separatedBy: " ")
let a = Int(inputLineArray[0])!
let b = Int(inputLineArray[1])!
print(a+b)
print(a-b)
print(a*b)
print(a/b)
print(a%b)
10430_나머지
A, B, C = map(int, input().split())
print((A+B)%C)
print(((A%C) + (B%C))%C)
print((A*B)%C)
print(((A%C) * (B%C))%C)
import Foundation
let inputLine = readLine()!
let inputLineArray = inputLine.components(separatedBy: " ")
let A = Int(inputLineArray[0])!
let B = Int(inputLineArray[1])!
let C = Int(inputLineArray[2])!
print((A + B) % C)
print(((A % C) + (B % C)) % C)
print((A * B) % C)
print(((A % C) * (B % C)) % C)
2588_곱셈
a = int(input())
b = input()
b_1 = int(b[2])
b_10 = int(b[1])
b_100 = int(b[0])
print(a*b_1)
print(a*b_10)
print(a*b_100)
print(a*int(b))
import Foundation
let inputFirstLine = Int(readLine()!)!
let inputSecondLine = readLine()!
let inputSecondLineArray = Array(inputSecondLine)
let units = Int(String(inputSecondLineArray[2]))!
let tens = Int(String(inputSecondLineArray[1]))!
let hundreds = Int(String(inputSecondLineArray[0]))!
print(inputFirstLine * units)
print(inputFirstLine * tens)
print(inputFirstLine * hundreds)
print(inputFirstLine * Int(inputSecondLine)!)