Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Function Name: leapYear % Inputs (1): - (double) A year % Outputs (1): - (char)

ID: 3649345 • Letter: F

Question

Function Name: leapYear
% Inputs (1): - (double) A year
% Outputs (1): - (char) A string that says whether it is a leap year or
% not
%
% Function Description:
% A year is actually a little bit longer than 365 days, so to make sure
% that we don't have Christmas in the July a few centuries later, we
% implement leap years with one extra day at the end of February. Even
% with this system, we will still be behind by one day in 8000 years!
%
% A leap year occurs every 4 years (if the year is divisible by 4), but
% years that are multiples of 100 are NOT leap years EXCEPT when that
% year is also a multiples of 400 (i.e. 1900 was not a leap year but 2000
% was a leap year).
%
% Write a function called "leapYear" that takes in a number representing
% a year and outputs the string 'It is a leap year.' if the given year is
% a leap year and outputs 'It is not a leap year.' if it is not a leap
% year.
%
% Notes:
% - Do not forget the period at the end of the output!
%
% Test Cases:
% out1 = leapYear(1993)
% out1 => 'It is not a leap year.'
%
% out2 = leapYear(1600)
% out2 => 'It is a leap year.'
%
% out3 = leapYear(300)
% out3 => 'It is not a leap year.'
%
% out4 = leapYear(2012)
% out4 => 'It is a leap year.'
%

Explanation / Answer

void leapyear(int year) { if (year%4==0)// % takes the mod of a number and since a leap year would be a multiple //of 4 thats why it should not give any remainder that's why if the mod of that year is //equal to zero only then it will be a leap year otherwise it won't be a leap year cout