torrent种子猫,株洲网站优化,复旦学霸张立勇做的网站,张家口网站建设电话2、用数组保存每个月份的天数#xff0c;输出每个月有多少天。
输入一个年份#xff0c;输出该年份每个月的天数#xff08;提醒#xff1a;闰年二月份多一天#xff09;
import java.util.Scanner;public class TianShu {public static void main(String[] args) {int a[…2、用数组保存每个月份的天数输出每个月有多少天。
输入一个年份输出该年份每个月的天数提醒闰年二月份多一天
import java.util.Scanner;public class TianShu {public static void main(String[] args) {int a[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};Scanner s new Scanner(System.in);System.out.println(请输入一个年份);int year s.nextInt();//判断闰年if ((year % 4 0 year % 100 ! 0) || year % 400 0) {a[1] 1;//二月份天数加1}//输出每个月的天数for (int i 0; i a.length; i) {System.out.println(year 年第 (i 1) 个月的天数 a[i]);}}
}