Created
June 29, 2017 05:29
-
-
Save P0huber/ef2966214c34b4af7e15f3d321dd4bdf to your computer and use it in GitHub Desktop.
Определение сколько дней в любом году. Description how are many days in any year [Java]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Quantity days in a year | |
*/ | |
import java.io.*; | |
public class Solution { | |
public static void main(String[] args) throws Exception { | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
System.out.print("Enter any year: "); | |
int x = Integer.parseInt(br.readLine()); | |
String s = "Quantity days in this year: 36"; | |
if (x % 100 == 0 && x % 400 != 0)// selection of unusual non leap years | |
System.out.println(s + "5"); | |
else if(x % 4 == 0)// selection of all leap years | |
System.out.println(s + "6"); | |
else // print all remaining non leap years | |
System.out.println(s + "5"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment