判断闰年 输出闰年
2016-09-22 21:26
357 查看
#include <stdio.h>
#include <stdlib.h>
int LeapYear(int n){
if((n%400==0)||(n%100!=0)&&(n%4==0)){
return 1;}
else{
return 0;
}
}
void main() {
int n;
printf("2000年到3000年之间所有的闰年如下:\n");
for(n=2000;n<=3000;n++){
if(LeapYear(n)==1)
{
printf("%d ",n);
}
}
printf("\n");
getch();
}
#include <stdio.h>
#include <stdlib.h>
int main(){
int n;
while (scanf("%d",&n)!=EOF){
if((n%400==0)||(n%100!=0)&&(n%4==0)){
printf("yes");
}
else
{
printf("no");
}
}
}
#include <stdlib.h>
int LeapYear(int n){
if((n%400==0)||(n%100!=0)&&(n%4==0)){
return 1;}
else{
return 0;
}
}
void main() {
int n;
printf("2000年到3000年之间所有的闰年如下:\n");
for(n=2000;n<=3000;n++){
if(LeapYear(n)==1)
{
printf("%d ",n);
}
}
printf("\n");
getch();
}
#include <stdio.h>
#include <stdlib.h>
int main(){
int n;
while (scanf("%d",&n)!=EOF){
if((n%400==0)||(n%100!=0)&&(n%4==0)){
printf("yes");
}
else
{
printf("no");
}
}
}
相关文章推荐
- PowerShell中判断闰年的方法
- 简单实现C#窗体程序判断是否闰年
- 用Java程序判断是否是闰年的简单实例
- Java判断是否为闰年的方法示例
- 如果使用编程判断闰年和平年,大神勿喷!
- 判断是否是闰年
- Java输入你一年份,判断是闰年还是平年
- 一个简单的日期选择器
- 闰年理解
- oracle 判断是否为闰年
- hdoj 1076 An Easy Task(有关闰年)
- 自用,java判断是否闰年
- 求闰年
- js判断是否是闰年
- C# 如何判断闰年代码
- 三天打鱼两天晒网
- 计算某年到某年之间相隔多少天(普通年有365天,润年有366天)
- 输入一个数字是否为闰年
- ACM:蓝桥杯:日期计算(闰年判断方法)
- 闰年判断方法