Answer to Question #3340 in C++ for mukunda
2011-07-05T09:14:50-04:00
Take a year as input and check whether it is leap year or not?
1
2011-07-15T14:26:47-0400
#include <iostream> using namespace std; int main() { int year; cout << "Please enter a year: "; cin >> year; bool leap = false; if (year % 400 == 0) leap = true; else if (year % 100 == 0) leap = false; else if (year % 4 == 0) leap = true; if (leap) cout << "This year is leap year." << endl; else cout << "This year is not 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 !
Learn more about our help with Assignments:
C++
Comments
Leave a comment