#include <iostream> using std::cout; using std::cin; int main() { int day; int month; cout << "Введите день месяца: "; cin >> day; cout <<"Введите день, с которого началаcя месяц "; cin >> month; if ((day >= 1 && day <=5 ) || (day >= 8 && day <=10)) { cout << "Праздничный день "; } else if ( day <= 0 || day > 31 || month > 7){ cout << "Некоректное значение"; } else if (((day + 1) % 7) == 0 || ((day + month - 1) % 7) == 0){ cout << "Выходной день"; } else { cout << "Рабочий день";} }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter