Question #219755

Write a program to input a year and find out that the year is leap year or not.

Expert's answer



#include <iostream>
using namespace std;


int main()
{
    int year;
  cout << "Enter a year" << endl;
  cin>>year;
  if(year % 400 == 0 || year % 4 == 0){
      cout<<"The year "<<year<<"  is a leap year"<<endl;
  }
  else{
      cout<<"The year "<<year<<"  is not a leap year"<<endl;
  }
  
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS