UVA10070:

Leap Year or Not Leap Year and ...

#include <iostream>;
//needs to be able to handle integers longer than long long as in the longest possible ints

using namespace std;

int main(){
	long n; 

	while(cin >> n){
		bool isLeapYear = ((n % 4 == 0) && (n % 100 != 0)) || (n % 400 == 0);
		bool isHuluculu = n % 15 == 0;
		bool isBulukulu = (n % 55 == 0) && isLeapYear;

		bool ordinaryYear =  !isLeapYear && !isHuluculu && !isBulukulu; 


		// cout << "LeapYear? " << isLeapYear << endl;
		// cout << "huluculu? " << isHuluculu << endl;
		// cout << "bulukulu? " << isBulukulu << endl;

		if(ordinaryYear){
			cout << "This is an ordinary year." << endl;

		} else {
			if(isLeapYear){
				cout << "This is leap year." << endl;
			} 

			if(isHuluculu){
				cout << "This is huluculu festival year." << endl;
			}

			if(isBulukulu){
				cout << "This is bulukulu festival year." << endl;
			}
		}

		cout << endl;

	}

	return 0;


}
[Back to Listing Page]

Home

Posts

Projects

Github

Contact

janzzen

Developed by Janzzen Ang powered by Vercel