on
TCL
- Get link
- X
- Other Apps
#!/usr/bin/tclsh
puts "Enter a year: "
gets stdin year
proc leap_year {year} {
if {$year % 4 == 0 && ( $year % 400 == 0 || $year % 100 != 0 )} {
puts "$year is a leap year"
} else {
puts "$year is not a leap year"
}
}
leap_year $year
Enter a year:
2020
2020 is a leap year
Enter a year:
1963
1963 is not a leap year
Comments
Post a Comment