public static int ReadNumber(int start, int end)
Console.WriteLine("Enter a number");
int number = int.Parse(Console.ReadLine());
if (number > end || number < start)
Exception e = new Exception("The number must be in the range");
catch (FormatException fe)
Console.WriteLine("Invalid format");
Console.WriteLine("The number must be in the range");
public static void ReadTenNumbers(int start, int end)
int[] array = new int[10];
for (int i = 1; i < 10; i++)
array[i] = ReadNumber(start, end);
if (array[i] < array[i-1])
Exception increasingNum = new Exception("Every new number should be larger than the previous one");
foreach (int num in array)
Console.Write(num + " ");
public static void Main()