-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3978f42
commit 559125f
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |