标签:
//题目:输入某年某月某日,判断这一天是这一年的第几天? Scanner sc=new Scanner(System.in); System.out.println("请输入年份"); int n =sc.nextInt(); System.out.println("请输入年份"); int y =sc.nextInt(); System.out.println("请输入年份"); int r=sc.nextInt(); int sum=0; int eryue=28; if((n%4==0 && n%100!=0) || n%400==0) { eryue=29; } switch(y) { case 1: sum=r; break; case 2: sum = 31+eryue+r; break; case 3: sum = 31+eryue+31+r; break; case 4: sum = 31+eryue+31+30+r; break; case 5: sum = 31+eryue+31+30+r; break; case 6: sum = 31+eryue+31+30+31+r; break; case 7: sum = 31+eryue+31+30+31+30+r; break; case 8: sum = 31+eryue+31+30+31+30+31+r; break; case 9: sum = 31+eryue+31+30+31+30+31+31+r; break; case 10: sum = 31+eryue+31+30+31+30+31+31+30+r; break; case 11: sum = 31+eryue+31+30+31+30+31+31+30+31+r; break; case 12: sum = 31+eryue+31+30+31+30+31+31+30+31+30+r; break; } System.out.println(n+" 年 "+y+" 月 " +r + "号是"+n+"年的第"+sum+"天");
标签:
原文地址:http://www.cnblogs.com/jskbk/p/5498565.html