Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var overnights, additionalCosts int
- var budget, overnightPrice float64
- fmt.Scanln(&budget)
- fmt.Scanln(&overnights)
- fmt.Scanln(&overnightPrice)
- fmt.Scanln(&additionalCosts)
- if overnights > 7 {
- overnightPrice *= 0.95
- }
- budget -= overnightPrice * float64(overnights) + 0.01 * budget * float64(additionalCosts)
- if budget >= 0 {
- fmt.Printf("Ivanovi will be left with %.2f leva after vacation.\n", budget)
- } else {
- fmt.Printf("%.2f leva needed.\n", math.Abs(budget))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement