Skip to content

Commit

Permalink
Create main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
matinsoleymni authored Jul 31, 2023
1 parent 3978f42 commit 559125f
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit 559125f

Please sign in to comment.