Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var seats, standardTickets, studentTickets, kidTickets int
- var movie, category string
- fmt.Scanln(&movie)
- for movie != "Finish" {
- var counter = 0
- fmt.Scanln(&seats)
- for counter != seats {
- fmt.Scanln(&category)
- if category == "End" {
- break
- } else if category == "standard" {
- standardTickets++
- } else if category == "student" {
- studentTickets++
- } else {
- kidTickets++
- }
- counter++
- }
- fmt.Printf("%s - %.2f%% full.\n", movie, float64(counter) / float64(seats) * 100.0)
- fmt.Scanln(&movie)
- }
- var totalTickets = studentTickets + standardTickets + kidTickets
- fmt.Printf("Total tickets: %d\n", totalTickets)
- fmt.Printf("%.2f%% student tickets.\n", float64(studentTickets) / float64(totalTickets) * 100.0)
- fmt.Printf("%.2f%% standard tickets.\n", float64(standardTickets) / float64(totalTickets) * 100.0)
- fmt.Printf("%.2f%% kids tickets.\n", float64(kidTickets) / float64(totalTickets) * 100.0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement