Rashmi dev

Rashmi dev

  • NA
  • 12
  • 5.5k

getting Index out of range error in C#

Feb 18 2014 6:39 AM

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)