Code:-
#include<iostream>
using namespace std;
void main()
{
int year;
cout<<"Enter a year to check leap year = ";
cin>>year;
if(year%4==0&&year%400==0)
{
cout<<"The year is a leap year (it has 366 days)."<<endl;
}
else
cout<<"The year is not a leap year (it has 365 days)"<<endl;
}
Output;-
#include<iostream>
using namespace std;
void main()
{
int year;
cout<<"Enter a year to check leap year = ";
cin>>year;
if(year%4==0&&year%400==0)
{
cout<<"The year is a leap year (it has 366 days)."<<endl;
}
else
cout<<"The year is not a leap year (it has 365 days)"<<endl;
}
Output;-
0 Questions:
Post a Comment