mercredi 28 novembre 2018

if statement with 3 conditions

I have a problem with a program that takes a calender year and calculates whether it's a leap year or not. my if statement just eats the input and doesn't work at all, what's the issue?

#include <stdio.h>

//program de a verifica daca un an calendar introdus este bisect sau nu

int main(int argc, char const *argv[])

{

int anul;

printf("\n");
printf("\nIntroduceti anul calender: ");

scanf("%d", &anul);


if( (anul%4==0) && (anul%100==!0) && (anul%400==0) )    
{
        printf("\n");
        printf("Anul %d este bisect", anul);
}

else
    printf("\n");
    printf("Anul %d NU este bisect", anul)


return 0;
}

Aucun commentaire:

Enregistrer un commentaire