import java.util.*;
public class YearMonthDay
{
public static void main(String[] args) throws Exception
{
int Day[]={31,28,31,30,31,30,31,30,31,30,31,30};
int y,m,d;
int Thisday=0;
int Feb=28;
Scanner input = new Scanner(System.in);
System.out.println("请输入年:");
y=input.nextInt();
System.out.println("请输入月:");
m=input.nextInt();
System.out.println("请输入天:");
d=input.nextInt();
if((y%4==0&&y%100!=0)||y%400==0)
{
Day[1] = 29;
}
for(int i=0;i<m-1;i++)
{
Thisday+=Day[i];
}
Thisday+=d;
System.out.println(y+"年"+m+"月"+d +"号是今年的第"+Thisday+"天");
}
}
时间: 2024-11-02 23:20:57