From 559125f1a1961d8ec321c5de46048e16308dd52c Mon Sep 17 00:00:00 2001 From: Matin Soleymani <110892827+matinsoleymni@users.noreply.github.com> Date: Mon, 31 Jul 2023 13:40:28 +0330 Subject: [PATCH] Create main.go --- main.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..ef28c3a --- /dev/null +++ b/main.go @@ -0,0 +1,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) + } +}