using System;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int firstRangeLeftBound = 0, firstRangeRightBound = 0,
secondRangeLeftBound = 0, secondRangeRightBound = 0;
Console.Write("Введите левую границу 1-го диапазона: ");
firstRangeLeftBound = int.Parse(Console.ReadLine());
Console.Write("Введите правую границу 1-го диапазона: ");
firstRangeRightBound = int.Parse(Console.ReadLine());
Console.Write("Введите левую границу 2-го диапазона: ");
secondRangeLeftBound = int.Parse(Console.ReadLine());
Console.Write("Введите правую границу 2-го диапазона: ");
secondRangeRightBound = int.Parse(Console.ReadLine());
if (firstRangeLeftBound < firstRangeRightBound && secondRangeLeftBound < secondRangeRightBound)
{
if ((firstRangeLeftBound > secondRangeLeftBound && firstRangeLeftBound > secondRangeRightBound) ||
(secondRangeLeftBound > firstRangeLeftBound && secondRangeLeftBound > firstRangeRightBound))
{
Console.Write("1-й диапазон: ");
for (int currentNumberFromRange = firstRangeLeftBound; currentNumberFromRange <= firstRangeRightBound; currentNumberFromRange++)
Console.Write(currentNumberFromRange.ToString() + " ");
Console.WriteLine();
Console.Write("2-й диапазон: ");
for (int currentNumberFromRange = secondRangeLeftBound; currentNumberFromRange <= secondRangeRightBound; currentNumberFromRange++)
Console.Write(currentNumberFromRange.ToString() + " ");
Console.WriteLine();
}
else
Console.WriteLine("Ошибка! Диапазоны пересекаются!");
}
else
Console.WriteLine("Ошибка! Неверно заданы границы!");
}
}
}