Answer to Question #45318 in C++ for abdul rasheed

Question #45318
Write a program in c++, using else if statements, to display if a given date of the month is a Sunday, public holiday or a working day. In a calendar month 2nd, 9th, 16th, 23rd and 30th are Sunday and 14th and 23rd are public holidays.
Expert's answer
#include <iostream>

using namespace std;

int main() {
int date;
// Input
cout << "Enter date: ";
cin >> date;

// Sunday (2nd, 9th,16th, 23rd and 30th) if
if ((date == 2) || (date == 9) || (date == 16) || (date == 23) || (date ==30)) {
cout << "This is a Sunday.";
// Public holiday (14thand 23rd) if
} else if ((date == 14) || (date == 23)) {
cout << "This is a public holiday.";
// Working day if
} else {
cout << "This is a working day.";
}

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

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal