Advertisement
Spocoman

Christmas Gifts

Oct 4th, 2024
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.54 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "strconv"
  6. )
  7.  
  8. func main() {
  9.     var kids, adults int
  10.     var input string
  11.     fmt.Scanln(&input)
  12.    
  13.     for input != "Christmas" {
  14.         years, _ := strconv.Atoi(input)
  15.         if years <= 16 {
  16.             kids++
  17.         } else {
  18.             adults++
  19.         }
  20.         fmt.Scanln(&input)
  21.     }
  22.  
  23.     fmt.Printf("Number of adults: %d\n", adults)
  24.     fmt.Printf("Number of kids: %d\n", kids)
  25.     fmt.Printf("Money for toys: %d\n", kids * 5)
  26.     fmt.Printf("Money for sweaters: %d\n", adults * 15)
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement