summaryrefslogtreecommitdiff
path: root/leapyear.java
blob: a57b45b2ce4b7bfbacbec681f47a941d4298e2db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package opdracht1;
import java.util.Scanner;	

public class leapyear {
	public static void main(String[] args) {
		//Setting up user input
		Scanner input = new Scanner(System.in);
		
		//Prompt
		System.out.println("enter the year you wish to evaluate");
				
		//Write input to variable		
		int value = input.nextInt();
		
		//Evaluate value using leap year loop and output 
		if (value%4 != 0) {
			System.out.println(value + " is a common year");
		}
		else if(value%100 !=0) {
			System.out.println(value + " is a leap year");
		}
		else if(value%400 !=0) {
			System.out.println(value + " is a common year");
		}
		else {
			System.out.println(value +" is a leap year");
		}
	}

}