Advertisement
Spocoman

Easter Party

Oct 8th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.62 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var guests int
  7.     fmt.Scanln(&guests)
  8.    
  9.     var envelope, budget float64
  10.     fmt.Scanln(&envelope)
  11.     fmt.Scanln(&budget)
  12.    
  13.     sum := float64(guests) * envelope
  14.  
  15.     if guests >= 10 && guests <= 15 {
  16.         sum *= 0.85
  17.     } else if guests > 15 && guests <= 20 {
  18.         sum *= 0.80
  19.     } else if guests > 20 {
  20.         sum *= 0.75
  21.     }
  22.  
  23.     sum += budget / 10
  24.  
  25.     if budget >= sum {
  26.         fmt.Printf("It is party time! %.2f leva left.\n", budget - sum)
  27.     } else {
  28.         fmt.Printf("No party! %.2f leva needed.\n", sum - budget)
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement