/*判断某个年份是否是闰年*/
#include "stdio.h"
int main (void )
{
int year, rem_4, rem_100, rem_400;
printf ("Enter the year to be tested: ");
scanf ("%i", &year);
rem_4 = year % 4;
rem_100 = year % 100;
rem_400 = year % 400;
if ( (rem_4 == 0 && rem_100 != 0) || rem_400 == 0)
printf ("It's a ;eep year. \n");
else
printf ("Nope, it's not a leap year.\n");
return 0;
}
判断一个年份是否是闰年
最新推荐文章于 2022-02-23 15:02:25 发布