It's an old philosophical problem: what was there before — a chicken or an egg? Let's try to answer!
Working with time
Chicken or egg
Report a typo
Sample Input 1:
1903 12 28
1912 6 23Sample Output 1:
Chicken is first!Write a program in Go
package main
import (
"fmt"
"time"
)
func main() {
var year, month, day int
// Chicken born time:
fmt.Scan(&year, &month, &day)
chicken := time.Date(?, time.Month(month), ?, 0, 0, 0, 0, time.UTC)
// Egg born time:
fmt.Scan(&year, &?, ?)
egg := time.Date(?, ?, ?, 0, 0, 0, 0, time.UTC)
switch {
case chicken.Before(?):
fmt.Println("Chicken is first!")
case chicken.?(egg):
fmt.Println("Egg is first!")
default:
fmt.Println("Time collapsed")
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.