Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var seaCount, mountCount, profit int
- fmt.Scanln(&seaCount)
- fmt.Scanln(&mountCount)
- var input string
- fmt.Scanln(&input)
- for input != "Stop" {
- if input == "sea" && seaCount > 0 {
- profit += 680
- seaCount--
- } else if input == "mountain" && mountCount > 0 {
- profit += 499
- mountCount--
- }
- if seaCount + mountCount == 0 {
- fmt.Println("Good job! Everything is sold.")
- break
- }
- fmt.Scanln(&input)
- }
- fmt.Printf("Profit: %d leva.", profit)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement