Advertisement
Spocoman

Excursion Sale

Oct 8th, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.64 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var seaCount, mountCount, profit int
  7.     fmt.Scanln(&seaCount)
  8.     fmt.Scanln(&mountCount)
  9.    
  10.     var input string
  11.     fmt.Scanln(&input)
  12.  
  13.     for input != "Stop" {
  14.         if input == "sea" && seaCount > 0 {
  15.             profit += 680
  16.             seaCount--
  17.         } else if input == "mountain" && mountCount > 0 {
  18.             profit += 499
  19.             mountCount--
  20.         }
  21.  
  22.         if seaCount + mountCount == 0 {
  23.             fmt.Println("Good job! Everything is sold.")
  24.             break
  25.         }
  26.         fmt.Scanln(&input)
  27.     }
  28.  
  29.     fmt.Printf("Profit: %d leva.", profit)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement