|
|
- package main
-
- import "fmt"
-
- func salesTax(cost float64, taxRate float64) float64 {
-
- return cost * taxRate / 100
-
- }
-
- func main() {
-
- taxTotal := 0.0
-
- taxTotal = salesTax(0.99, 7.5)
- taxTotal += salesTax(2.75, 1.5)
- taxTotal += salesTax(0.87, 2.0)
-
- fmt.Println("Sales Tax Total:", taxTotal)
-
- }
|