I'm only interested in leap years. So if the inputted year is not a leap year, give me the next soonest leap year. IN JA

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

I'm only interested in leap years. So if the inputted year is not a leap year, give me the next soonest leap year. IN JA

Post by answerhappygod »

I'm only interested in leap years. So if the inputted year is
not a leap year, give me the next soonest leap year.
IN JAVA CODE:
A year is considered a leap year when it is either:
(a) divisible by 4, but not 100 or
(b) divisible by both 4, 100, and 400 at the same time
Input
A single line containing a number that represents a year.
1702
Output
The next soonest leap year if the input is not a leap year.
Otherwise, output "Leap year".
The next leap year is 1704
Test Case 2:
Input
Output
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply