C语言:判断闰年的方法
闰年的定义:闰年是公历中的名词。闰年分为普通闰年和世纪闰年。普通闰年:公历年份是4的倍数的,一般是闰年(如2004年就是闰年);
世纪闰年:公历年份是整百数的,必须是400的倍数才是闰年(如1900年不是世纪闰年,2000年是世纪闰年);
编程要点:
1>能被4整除不能被100整除
2>能被400整除
如下是判断输入的年份是不是闰年
#include <stdio.h>
#include <windows.h>
#pragma warning(disable:4996)
int main()
{
int Year;
scanf("%d", &Year);
if ((Year % 400 == 0)||(Year % 4 == 0)&&(Year % 100 != 0)){
printf