I've just started an introduction to c programming course - and I'm trying to write a program that prints all the leap years between the start and end year entered.
#include <stdio.h>
int main (void) {
int start, finish, leap;
printf("Enter start year: ");
scanf("%d", &start);
printf("Enter finish year: ");
scanf("%d", &finish);
while (start <= finish) {
if ((start%400 == 0) || (start%4 == 0))
else if (year%100 != 0)
}
printf("%d\n", start);
start = start + 1
return 0;
}
I keep getting the "expected expression" error and it points to the beginning of the else if statement. Worked in stages, and the if statement works to print out all years divisible by 400 or 4.
I'm trying to exclude numbers that are divisible by 100 now... any ideas on what's going wrong?
Aucun commentaire:
Enregistrer un commentaire