Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,15 @@ import (

// 時間を表示する簡単なgo言語のプログラム
func main() {
fmt.Println("The time is", time.Now())
now := time.Now()
fmt.Println("The time is", now)

year := now.Year()
isLeapYear := year%4 == 0 && (year%100 != 0 || year%400 == 0)

if isLeapYear {
fmt.Printf("%d年はうるう年です\n", year)
} else {
fmt.Printf("%d年はうるう年ではありません\n", year)
}
}