一年的天数 Exercise06_16
生活随笔
收集整理的這篇文章主要介紹了
一年的天数 Exercise06_16
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 /**
2 * @author 冰櫻夢
3 * 時間:2018年下半年
4 * 題目:一年的天數
5 *
6 */
7 public class Exercise06_16 {
8 public static void main(String[] args){
9 for(int i=2000;i<=2020;i++){
10 System.out.print(numberOfDaysInAYear(i)+" ");
11 }
12 }
13 //返回天數
14 public static int numberOfDaysInAYear(int i){
15 int years;
16 if((i%4==0 && i%100!=0)||(i%400==0)) years=366;
17 else years=365;
18 return years;
19 }
20 }
?
轉載于:https://www.cnblogs.com/cherrydream/p/10173848.html
總結
以上是生活随笔為你收集整理的一年的天数 Exercise06_16的全部內容,希望文章能夠幫你解決所遇到的問題。