Advertisement
Spocoman

01. Match Tickets

Sep 19th, 2024
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.88 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var budget float64
  6.     fmt.Scanln(&budget)
  7.    
  8.     var category string
  9.     fmt.Scanln(&category)
  10.    
  11.     var people int
  12.     fmt.Scanln(&people)
  13.  
  14.     var sum = 0.0
  15.  
  16.     if (people >= 1 && people <= 4) {
  17.         budget *= 0.25
  18.     } else if (people > 4 && people <= 9) {
  19.         budget *= 0.40
  20.     } else if (people > 9 && people <= 24) {
  21.         budget *= 0.50
  22.     } else if (people > 24 && people < 50) {
  23.         budget *= 0.60
  24.     } else {
  25.         budget *= 0.75
  26.     }
  27.  
  28.     if (category == "VIP") {
  29.         sum = 499.99 * float64(people)
  30.     } else if (category == "Normal") {
  31.         sum = 249.99 * float64(people)
  32.     }
  33.  
  34.     if (budget >= sum) {
  35.         fmt.Printf("Yes! You have %.2f leva left.", budget - sum)
  36.     } else {
  37.         fmt.Printf("Not enough money! You need %.2f leva.", sum - budget)
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement