Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "strconv"
- )
- func main() {
- var seats, groupCount, income int
- fmt.Scanln(&seats)
- var command string
- fmt.Scanln(&command)
- for command != "Movie time!" {
- groupCount, _ = strconv.Atoi(command)
- if groupCount > seats {
- break
- }
- seats -= groupCount
- income += groupCount * 5
- if groupCount % 3 == 0 {
- income -= 5
- }
- fmt.Scanln(&command)
- }
- if command == "Movie time!" {
- fmt.Printf("There are %d seats left in the cinema.\n", seats)
- } else {
- fmt.Println("The cinema is full.")
- }
- fmt.Printf("Cinema income - %d lv.\n", income)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement