10.c++ program to check if a leap year or not
// C++ program to check if a year is leap year or not
INPUT:
#include<iostream>
using namespace std;
int main()
{
int z;
cout<<"Enter a year:";
cin>>z;
if(z%4==0){
if(z%100==0){
if(z%400==0)
cout<<"\n\t"<<z<<" is a leap year";
else
cout<<"\n\t"<<z<<" is not a leap year";
}
else
cout<<"\n\t"<<z<<" is a leap year";
}
else
cout<<"\n\t"<<z<<" is not a leap year";
return 0;
}
OUTPUT:
Comments
Post a Comment