Advertisement
Spocoman

Summer Shopping

Oct 13th, 2024
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.56 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var budget, towel, discount float64
  7.     fmt.Scanln(&budget)
  8.     fmt.Scanln(&towel)
  9.     fmt.Scanln(&discount)
  10.  
  11.     umbrella := towel / 3 * 2
  12.     flipFlops := umbrella * 0.75
  13.     beachBag := (towel + flipFlops) / 3
  14.     sum:= (towel + umbrella + flipFlops + beachBag) * (100 - discount) / 100
  15.  
  16.     fmt.Printf("Annie's sum is %.2f lv. ", sum)
  17.     if budget >= sum {
  18.         fmt.Printf("She has %.2f lv. left.", budget - sum)
  19.     } else {
  20.         fmt.Printf("She needs %.2f lv. more.", sum - budget)
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement