关于C语言的程序设计题,求解
发布网友
发布时间:2023-10-20 06:38
我来回答
共3个回答
热心网友
时间:2024-12-04 03:15
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int year,leap;
scanf("%d",&year);
if(year%4==0)
leap = 1;
else leap = 0;
if(leap==1)
printf("该年为闰年");
else printf("该年不是闰年");
}
热心网友
时间:2024-12-04 03:16
#include <stdio.h>
int main()
{
int year;
int leap = 0;
scanf("%d", &year);
if(year%4==0&&year%100!=0||year%400==0)
leap = 1;
if(leap) printf("闰年\n");
else printf("非闰年\n");
return 0;
}
热心网友
时间:2024-12-04 03:16
#include<stdio.h>
void main()
{
int year,leap = 0;
printf("请输入年份:");
scanf("%d",&year);
if((year%4==0&&year%100!=0)||(year%400==0))
leap=1;
if(leap==1)
printf("\n%d此年是闰年\n",year);
else printf("%d此年非闰年\n",year);
}