import java.util.Scanner;
public class QiuOneyear_dayshu {
public static void main(String[] args) {//switch求一年中的天数
Scanner scanner = new Scanner(System.in);
int year = scanner.nextInt();
int month = scanner.nextInt();
int day = scanner.nextInt();
int n=day;
int [] array ={31,28,31,30,31,30,31,31,30,31,30,31};//第几个月那就前面的累计相加
int [] run ={31,29,31,30,31,30,31,31,30,31,30,31};//闰年
if (month>12||day>31)
{
System.out.print("输入有误,程序结束");
System.exit(0);
}
if(year%4==0&&year%100!=0||year%400==0)
{
for (int i=0;i<month;i++)
{
n=n+run[i];
}
}else
{
for (int i=0;i<month;i++)
{
n=n+array[i];
}
}
System.out.print("这是一年中的第"+n+"天");
}
}
版权声明:本文为actores原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。