Question: Find the five errors in the below code segment and rectify them 1. class SubscriptValidation 2. { 3. static void main() 4. { 5. int[]

Find the five errors in the below code segment and rectify them

1. class SubscriptValidation

2. {

3. static void main()

4. {

5. int[] array = ( 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 );

6. int sub;

7. const int QUIT = 99;

8. Console.Write("Enter a subscript value or {0} to quit >> ", QUIT);

9. sub = Convert(Console.ReadLine());

10. while (sub != QUIT)

11. {

12. Try

13. {

14. Console.WriteLine("The value is {0}", array[sub]);

15. }

16. catch (IndexOutOfRangeException e)

17. {

18. Console.WriteLine(e.Message);

19. }

20. Console.Write("Enter a subscript value or {0} to quit >> " QUIT);

21. sub = Convert.ToInt32(Console.ReadLine());

22. }

23. }

24. }

....

C# answer asap please!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!