Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
301 B

  1. package main
  2. import "fmt"
  3. func salesTax(cost float64, taxRate float64) float64 {
  4. return cost * taxRate / 100
  5. }
  6. func main() {
  7. taxTotal := 0.0
  8. taxTotal = salesTax(0.99, 7.5)
  9. taxTotal += salesTax(2.75, 1.5)
  10. taxTotal += salesTax(0.87, 2.0)
  11. fmt.Println("Sales Tax Total:", taxTotal)
  12. }