Skip to content

Instantly share code, notes, and snippets.

@P0huber
Created June 29, 2017 05:29
Show Gist options
  • Save P0huber/ef2966214c34b4af7e15f3d321dd4bdf to your computer and use it in GitHub Desktop.
Save P0huber/ef2966214c34b4af7e15f3d321dd4bdf to your computer and use it in GitHub Desktop.
Определение сколько дней в любом году. Description how are many days in any year [Java]
/*
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