summaryrefslogtreecommitdiff
path: root/leapyear.java
diff options
context:
space:
mode:
Diffstat (limited to 'leapyear.java')
-rw-r--r--leapyear.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/leapyear.java b/leapyear.java
new file mode 100644
index 0000000..a57b45b
--- /dev/null
+++ b/leapyear.java
@@ -0,0 +1,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");
+ }
+ }
+
+}