3
Answers

getting Index out of range error in C#

Rashmi dev

Rashmi dev

10y
848
1

hi,

am new to c# and am getting index out of range error please help me my code

int index = 1;


int[] numArray = new int[num2];


for (int i = num1; i <= num2; i++)




{


numArray[index] = i;



Console.WriteLine(" index: {0} assignment: {1}", index, i);




index++;



Console.WriteLine("index: {0}", index);




}

please help me


Answers (3)