闰年判断

#include <iostream>
using namespace std;
int main(){
    int y;
    cout<<"enter a year"<<endl;   //y%4==0&&100%y!=0||400%y==0
    cin>>y;
    if(y%4==0){
        if(100%y==0){
            if(y%400==0){
                cout<<"zhe shi run nian";                        
            }else{
                cout<<"zhe bu shi run nian";
            }
    }else{
        cout<<"zhe  shi run nian";
    }
    }else{
        cout<<"zhe bu shi run nian";
    }
    return 0;
}

 

 

 

posted on 2017-10-19 15:48  三叶癌  阅读(87)  评论(0编辑  收藏  举报

导航