diff options
| author | Arne Visscher <avisscher@sogyo.nl> | 2016-02-03 10:01:04 +0100 |
|---|---|---|
| committer | Arne Visscher <avisscher@sogyo.nl> | 2016-02-03 10:01:04 +0100 |
| commit | bc4871842a50dcbf72e13c591aa6fbe9be8b55f7 (patch) | |
| tree | beb13fb358ae894daf0dfc33220bf16374b11aba | |
| parent | 23f5daa9dd21d9c177765fcd795ecb25ea4c1508 (diff) | |
Programma vraagt via scanner om integer en controleerd op schrikkeljaar
| -rw-r--r-- | leapyear.java | 30 |
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"); + } + } + +} |
