Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal class Program
- {
- enum Зима { Декабрь = 12, Январь = 1, Февраль = 2 };
- enum Весна { Март = 3, Апрель = 4, Май = 5 };
- enum Лето { Июнь = 6, Июль = 7, Август = 8 };
- enum Осень { Сентябрь = 9, Октябрь = 10, Ноябрь = 11 };
- private static void PrintSeson(int n)
- {
- if(Enum.IsDefined(typeof(Зима),n))
- Console.WriteLine(nameof(Зима));
- else if(Enum.IsDefined(typeof(Весна),n))
- Console.WriteLine(nameof(Весна));
- else if(Enum.IsDefined(typeof(Лето),n))
- Console.WriteLine(nameof(Лето));
- else if(Enum.IsDefined(typeof(Осень),n))
- Console.WriteLine(nameof(Осень));
- else
- throw new ArgumentException("Такой месяц в году отсутствует");
- }
- private static void Main(string[] args)
- {
- for(int i = 1; i <= 12; i++)
- {
- PrintSeson(i);
- }
- Console.ReadLine();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement