赞
踩
#include<stdio.h> #include<math.h> int main() { int year = 0; scanf_s("%d", &year); //能被4整除不能被100整除 //能被400整除 for (year; year <= 2020; year++) { if (year % 4 == 0 && year % 100 != 0) { printf("%d是闰年\n", year); } else if (year % 400 == 0) printf("%d是闰年\n", year); else printf(""); } return 0; }
结果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。