//例子5.5 写程序,判断某一年是闰年
#include <stdio.h>
void main()
{
int year,leap;
scanf("%d",&year);
if (year%4==0)
if(year%100==0)
if(year%400==0)
leap=1;
else
leap=0;
else
leap=1;
else
leap=0;
if(leap=1)
printf("%d is a leap year",year);
else
printf("%d is not a leap year",year);
}
//1、等于是==
// 2、书上用
//if(leap=1)
// printf("%d is ",year);
//else
//printf("%d is not ",year);
//printf(" a leap year./n"); 很聪明哦 这里到第1个封号为止
//最后一行用/n可以跟press any key to continue 区分
//例子5.5 写程序,判断某一年是闰年
最新推荐文章于 2022-01-02 11:43:55 发布