Skip to content
This repository was archived by the owner on Dec 10, 2021. It is now read-only.

Commit d6c5fe3

Browse files
committed
ht5: leap year 2.0
1 parent e47ebc1 commit d6c5fe3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Main.class

236 Bytes
Binary file not shown.

src/Main.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ public static void main(String[] args) throws IOException{
217217
//task 4
218218
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
219219
int n = Integer.parseInt(reader.readLine());
220-
System.out.println("With Java I would earn " + n + " thousand rubles per hour."); }
220+
System.out.println("With Java I would earn " + n + " thousand rubles per hour.");
221+
//task 5
222+
int year = Integer.parseInt(reader.readLine());
223+
leap(year);
224+
}
221225

222226
public static void sum(int a, int b) {
223227
int c = a + b;
@@ -242,4 +246,12 @@ public static void javaLearn() {
242246
System.out.println("Java");
243247
}
244248
}
249+
public static void leap(int year) {
250+
if (year % 4 == 0 & year % 100 != 0 | year % 400 == 0) {
251+
System.out.println("The year is leap");
252+
}
253+
else {
254+
System.out.println("The year isn't leap");
255+
}
256+
}
245257
}

0 commit comments

Comments
 (0)