Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var amount float64
- fmt.Scanln(&amount)
- var puzzles, dolls, bears, minions, trucks int
- fmt.Scanln(&puzzles)
- fmt.Scanln(&dolls)
- fmt.Scanln(&bears)
- fmt.Scanln(&minions)
- fmt.Scanln(&trucks)
- var puzzlePrice = float64(puzzles) * 2.60
- var dollsPrice = float64(dolls) * 3.00
- var bearsPrice = float64(bears) * 4.10
- var minionsPrice = float64(minions) * 8.20
- var trucksPrice = float64(trucks) * 2.00
- var toys = puzzles + dolls + bears + minions + trucks
- var price = puzzlePrice + dollsPrice + bearsPrice + minionsPrice + trucksPrice
- if (toys >= 50) {
- price *= 0.75
- }
- price *= 0.9
- if (price >= amount) {
- fmt.Printf("Yes! %.2f lv left.", price - amount)
- } else {
- fmt.Printf("Not enough money! %.2f lv needed.", amount - price)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement