Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need help finishing this code. please help and zoom in if needed! Write a program that reads an integer which represents a year. The program
need help finishing this code. please help and zoom in if needed!
Write a program that reads an integer which represents a year. The program should then determine if the year was/is/will be a leap year (a year made up of 366 days.) A leap year is a year that is divisible by 4 with the following exception the centurial years that are divisible by 100 but not divisible by 400, such as 1700, 1800, 1900, and 2100, are NOT leap years. The century years that are divisible by 400, ARE leap years, for instance 1600, 2000, and 2400. Your previous leap year program used nested if-else constructs (and only nested if-else, no && or operators). Using the same divisiblity logic, this program should use one single condition involving logical and and or (& & and I 1) that represents the whole leap year condition Hint Here you will have a single if condition, such as the following: if ( ( (condition 1) && (condition 2)) || (condition 3)) { 17 year is a leap year else Il year is not a leap year } Your program should output one of the following statements based on whether or not XXXX is a leap year XXXX. is a leap year. XX.X.X. is not a leap year. When the input is as shown if Figure 1. your program should produce output as shown in Figure 2. Figure 1: (sample input) 2018 Figure 2 (sample output) 2018 is not a leap year. 5 #include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started