Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var budget float64
- fmt.Scanln(&budget)
- var guests int
- fmt.Scanln(&guests)
- var bananaPrice, eggPrice, berriesKiloPrice float64
- fmt.Scanln(&bananaPrice)
- fmt.Scanln(&eggPrice)
- fmt.Scanln(&berriesKiloPrice)
- neededMoney := math.Ceil(float64(guests) / 6) * (bananaPrice * 2 + eggPrice * 4 + berriesKiloPrice / 5)
- if budget >= neededMoney {
- fmt.Printf("Ivancho has enough money - it would cost %.2flv.", neededMoney)
- } else {
- fmt.Printf("Ivancho will have to withdraw money - he will need %.2flv more.", neededMoney - budget)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement