Hey all,

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...
printf
sscanf
fgets
if
else
while
break
continue
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

Code:
#include <stdio.h>

char    line[10];
int     year;
int     leap1;
int     leap2;
int     leap3;

int main()
{
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);
}else{
printf("%d is not a leapyear\n", year);
}

return(0);
}
Any help is greatly appreciated.