mathops
This commit is contained in:
parent
220522e1b2
commit
61d9fb0587
2 changed files with 17 additions and 1 deletions
10
functions/demo2.go
Normal file
10
functions/demo2.go
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package functions
|
||||||
|
|
||||||
|
func MathOps(number1 int, number2 int) (int, int, int, float32){
|
||||||
|
add := number1 + number2
|
||||||
|
subtract := number1 - number2
|
||||||
|
multiply := number1 * number2
|
||||||
|
divide := float32(number1 / number2)
|
||||||
|
|
||||||
|
return add, subtract, multiply, divide
|
||||||
|
}
|
8
main.go
8
main.go
|
@ -18,8 +18,14 @@ func main() {
|
||||||
arrays.Demo4()
|
arrays.Demo4()
|
||||||
slices.Demo2()
|
slices.Demo2()
|
||||||
functions.SayHello("Mert Gör")
|
functions.SayHello("Mert Gör")
|
||||||
// functions.Addition(2,6)
|
functions.Addition(2,6)
|
||||||
var total = functions.Addition(3,8)
|
var total = functions.Addition(3,8)
|
||||||
fmt.Println(total)
|
fmt.Println(total)
|
||||||
fmt.Println(total * 10)
|
fmt.Println(total * 10)
|
||||||
|
|
||||||
|
result1, result2, result3, result4 := functions.MathOps(10,2)
|
||||||
|
fmt.Println("Add :", result1)
|
||||||
|
fmt.Println("Subtract :", result2)
|
||||||
|
fmt.Println("Multiply : ", result3)
|
||||||
|
fmt.Println("Divide : ", result4)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue