Question: Consider the following algorithm. 1. ???????? ? Input a four digit year. 2. if (???????? mod 4 = 0) { Divisible by 4 } 2.1

Consider the following algorithm. 1. ???????? ? Input a four digit year.Consider the following algorithm. 1. ???????? ? Input a four digit year. 2. if (???????? mod 4 = 0) { Divisible by 4 } 2.1 if (???????? mod 100 = 0) { Divisible by 100 } 2.1.1 if (???????? mod 400 = 0) {Divisible by 400} 2.1.1.1 isLeapYear ? TRUE; 2.1.2 Else 2.1.2.1 isLeapYear ? FALSE; 2.1.3 End if 2.2 Else { Not divisible by 100} 2.2.1 isLeapYear ? TRUE; 2.3 End if 3. Else { Not divisible by 4 } 3.1 isLeapYear ? FALSE; 4. End if 5. Output isLeapYear a) Trace the algorithm starting with the input 1500. b) Document the changes that would need to be made to the algorithm after step 4 to output the number of days in a specific year. Make sure that you describe the changes in detail.

Question 3 [6 marks] Consider the following algorithm. 1. year - Input a four digit year 2. if (year mod 4 - 0 Divisible by 4) 2.1 if (year mod 100 = 0) { Divisible by 100, 2.1.1 if (year mod 400visible by 400) 2.1.1.1 isLeapYear

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!