Topic 1039: [Introduction to Programming] Leap Year Judgment of Macro Definition

 

//
#include<bits/stdc++.h>
using namespace std;
#define is_leap(y) ( ( y%4==0 && y%100 ) || ( y%100==0 && y%400==0 ) )

int main()
{
    int y;
    while( cin>>y )
    {
        if( is_leap(y) )    cout<<"L"<<endl;
        else                cout<<"N"<<endl;
    }
    return 0;
}

Guess you like

Origin blog.csdn.net/qq_63173957/article/details/123869783