mirea-projects/Third term/Programming of corporate systems/2/1.cs
2024-09-24 02:22:33 +03:00

29 lines
1.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
class CalendarProgram
{
static void Main()
{
Console.Write("Введите номер дня недели, с которого начинается месяц (1-пн, ..., 7-вс): ");
int firstDayOfWeek = int.Parse(Console.ReadLine());
if (firstDayOfWeek < 1 || firstDayOfWeek > 7)
{
Console.WriteLine("Неверный номер дня недели");
return;
}
Console.Write("Введите день месяца (1-31): ");
int dayOfMonth = int.Parse(Console.ReadLine());
if (dayOfMonth < 1 || dayOfMonth > 31)
{
Console.WriteLine("Неверный день месяца");
return;
}
int dayOfWeek = (firstDayOfWeek + (dayOfMonth - 1)) % 7;
if (dayOfMonth <= 5 || (dayOfMoynth >= 8 && dayOfMonth <= 10) || dayOfWeek == 6 || dayOfWeek == 0)
Console.WriteLine("Выходной день");
else Console.WriteLine("Рабочий день");
}
}