Write a program to determine whether a certain year is a leap year, C language

code show as below:

# include <stdio.h>
# include < math.h>
int main()
{     int year=0;     int leap=0;     scanf_s("%d\0",&year );     if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)//A logical expression is used here to include all Leap year conditions are the simplest and most intuitive of all methods         leap = 1;     else leap =0;     if (leap = = 1)         printf("yes");     else printf("no");     return 0;






    




     

}

Attached is the compilation result:

 

The compiler is vs code 2022. Dear viewers, please give me a thumbs up before leaving. The little girl would like to thank you.

Guess you like

Origin blog.csdn.net/m0_64854963/article/details/126236365