Select Page

Function Code Calculation Example

func calculator() { let a = Int(readLine()!)! //First input let b = Int(readLine()!)! //Second input add(n1: a, n2: b) subtract(n1: a, n2: b) multiply(n1: a, n2: b) divide(n1: a, n2: b) } func add(n1: Int,n2: Int) { print(n1 + n2) } add(n1: 3, n2: 4) func subtract(n1:...