Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- bool isLeapYear(int year)
- {
- if(year % 400 == 0)
- return true;
- if(year % 100 == 0)
- return false;
- if(year % 4 == 0)
- return true;
- return false;
- }
- int main()
- {
- int years[12] = {2000,2004,2005,2006,2007,2008,2100,2101,2102,2104,2200,2400};
- for(int i=0; i<12; ++i)
- {
- if(isLeapYear(years[i]))
- {
- std::cout << years[i] << " is leap year."<<std::endl;
- }
- else
- {
- std::cout << years[i] << " is NOT leap year."<<std::endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment