You are on page 1of 2

/******************************************************

* Author: Gayathri Tharamalingam (CE092982)


*
*
Nurul Amirah Bt Mohammed Noor(CE093474)
*
* Course: CSEB113
*
* Section: 05B
*
* Date:31/7/15
*
* Brief description:A C programthat reads two
*
* positive integers corresponding to two year
*
* values, ensures that the first year value is
*
* less than the second,
*
* and then determines and outputs all year values for *
* leap years.
*
******************************************************/
#include <stdio.h>
int main(void)
{
int year0,year1, year;
printf("Enter the starting year and the ending year\n");
printf("The value for the starting year must be less than the value for the ending year\n");
printf("\nEnter year1:");
scanf("%d", &year1);
printf("\nEnter year:");
scanf("%d", &year);
if (year1 > year)
{
printf("\nThe value for the starting year must be less than the value for the ending
year\n");
printf("\nEnter year1:");
scanf("%d", &year1);
printf("\nEnter year:");
scanf("%d", &year);
}
printf("\n\nThe following are the leap year<s> between %d and %d\n\n", year1, year);
for (year0 = year1;year0 <= year;year0++)
{
if (((year0 % 4 == 0) && (year0 % 100 != 0)) || (year0 % 400 == 0))
printf("%d\t", year0);
}

return 0;
}

You might also like