IT/백준
[백준] 단계별로 풀어보기 - 1단계 10869번
안경 쓴 귀니
2020. 9. 20. 17:01
반응형
문제
두 자연수 A와 B가 주어진다. 이때, A+B, A-B, A*B, A/B(몫), A%B(나머지)를 출력하는 프로그램을 작성하시오.
답
1
2
3
4
5
6
7
8
9
10
11
12
|
import Foundation
let line = readLine() ?? ""
let lineArr = line.split(separator: " ")
let a = Int(lineArr[0]) ?? 0
let b = Int(lineArr[1]) ?? 0
print(a+b)
print(a-b)
print(a*b)
print(a/b)
print(a%b)
|
cs |
반응형