I'm doing an example question from my C book.. a leap year is any year divisible by 4, unless it's divisible by 100 but not 400. this is what I came up with, but it won't compile. it says "leap.c:14: error: lvalue required as left operand of assignment"..
Code:
#include <stdio.h>
char line[10];
int input;
main()
{
printf("Is this year a leap year?\nInput year: ");
fgets(line, sizeof(line), stdin);
sscanf(line, "%d", &input);
if (input%4 == 0)
{
if ((input%100 == 0) && (input%400 =! 0))
printf("Is not a leap year\n");
else printf("Is a leap year\n");
}
else printf("Is not a leap year\n");
return (0);
}
anyone know what the deal is? thanks for any help!!