Write a program for determining if a year is a leap year. In the Gregorian calendar
system you can check if it is a leap year if it is divisible by 4 but not by 100 unless it is also divisible by 400.
For example, 1896, 1904, and 2000 were leap years but 1900 was not.
Write a program that takes in a year as input (as a command line argument) and returns the string “{year} was a leap year” if true and “{year} was not a leap year” if false.
Note: background on leap year https://en.wikipedia.org/wiki/Leap_year. Also, to pass the autograder, you must call your program as shown below. More information on how to write your main function to do this can be found here: https://www.tutorialspoint.com/What-does-int-argc-char-argv-mean-in-C-Cplusplus
Here is a positive example call to the program
.isleapyear 1896
output:
1896 was a leap year
Here is a negative example call to the program
.isleapyear 1897
output:
1897 was not a leap year
File Name
isleapyear.c
Score
There are five tests each worth 1 point


0 comments