-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (32 loc) · 841 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import "fmt"
func main() {
fmt.Print("Enter Number: ")
var one int
fmt.Scan(&one)
fmt.Print("Enter Number: ")
var two int
fmt.Scan(&two)
fmt.Print("Enter operation: ")
var op string
fmt.Scan(&op)
calc(one, two, op)
fmt.Println("\n\n24 is here ∞")
fmt.Scan(&op)
}
func calc(numberOne int, numberTwo int, operation string) {
fmt.Printf("\nYou Say: %v %v %v \n", numberOne, operation, numberTwo)
if operation == "/" {
result := numberOne / numberTwo
fmt.Printf("result is ~= %v", result)
} else if operation == "+" {
result := numberOne + numberTwo
fmt.Printf("result is = %v", result)
} else if operation == "-" {
result := numberOne - numberTwo
fmt.Printf("result is = %v", result)
} else if operation == "*" {
result := numberOne * numberTwo
fmt.Printf("result is = %v", result)
}
}