Answer to Question #219755 in C++ for Ashir

Question #219755
Write a program to input a year and find out that the year is leap year or not.
1
Expert's answer
2021-07-22T18:46:05-0400


#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS