I have the following problem...
"A leap year is any year divisible by 4, unless the year is divisible by 100 but not 400. Write a program to tell if a year is a leap year."
I can use the following...
I can't use &&
Basically I can use what you see below.
So far I have this but I don't know what else to do. The following doesn't work. Basically I need help with what comes after the if (leap1 == 0) part
Any help is greatly appreciated.
printf("Enter the year to find out if it is a leap year: ");
fgets(line, sizeof(line), stdin);
sscanf(line, "%d", &year);
/*A leapyear is any year divisible by 4, unless the year is divisible by 100 but not 400.*/
leap1 = year % 4;
leap2 = year % 100;
leap3 = year % 400;
if (leap1 == 0)
printf("%d is a leapyear\n", year);
printf("%d is not a leapyear\n", year);