Try Catch Exception in C#

Hello I was doing my assignment of this given question.But the problem is that it is not giving any right output of this program.I have tried so many times but the output gives me wrong.

“Write a method ReadNumber(int start, int end) that reads an integer from the console in the range [start…end]. In case the input integer is not valid or it is not in the required range throw appropriate exception. Using this method, write a program that takes 10 integers a1, a2, …, a10 such that 1 < a1 < … < a10 < 100.”

 In the main program i have passed the parameters of start=1 and end=100.Any Ideas or suggestions on how to solve this program??

You need to test the integer value entered by the user against the start and end values. In your current code you don’t do that. “Int32.Parse()” won’t throw an ArgumentOutOfRangeException for you.