在 if 语句里面,你可以使用另外一个 if 语句.只要你能逻辑管理 你就可以使用多层嵌套. 以下是一个测试闰年的例子: #!/bin/bash # This script will test if we're in a leap year or not. year=`date +%Y` if [ $[$year % 400] -eq "0" ]; then echo "This is a leap year. February has 29 days."
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _03判断闰年 { class Program { static void Main(string[] args) { //举例:写一个方法,判断一个年份是否是润年. bool b = IsRun(2000); Console.WriteLine(