package com.codegym.task.task04.task0414;
/*
Number of days in the year
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
InputStream inputStream= System.in;
Reader inputStreamReader = new InputStreamReader(inputStream);
int year = inputStreamReader.read();
boolean leap = false;
if(year % 4 == 0)
{
if( year % 100 == 0)
{
if ( year % 400 == 0)
leap = true;
else
leap = false;
}
else
leap = true;
}
else
leap = false;
if(leap)
System.out.println("Number of days in the year: 366");
else
System.out.println("Number of days in the year: 365");
}
}
package com.codegym.task.task04.task0414;
/*
Number of days in the year
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
InputStream inputStream= System.in;
Reader inputStreamReader = new InputStreamReader(inputStream);
int year = inputStreamReader.read();
boolean leap = false;
if(year % 4 == 0)
{
if( year % 100 == 0)
{
// year is divisible by 400, hence the year is a leap year
if ( year % 400 == 0)
leap = true;
else
leap = false;
}
else
leap = true;
}
else
leap = false;
if(leap)
System.out.println("Number of days in the year: 366");
else
System.out.println("Number of days in the year: 365");
}
}