Question: What output is produced by the following code? int i; int [ ] anArray = new int [5]; for (i = 0; i < anArray.Length;
What output is produced by the following code?
int i;
int [ ] anArray = new int [5];
for (i = 0; i < anArray.Length; i++)
anArray [i] = 2 * i;
for (i = 0; i < anArray.Length; i++)
Console.Write(anArray [i] + " ");
a. 2 2 2 2 2
b. 2 4 6 8 10
c. 0 2 4 6 8 10
d. 0 2 4 6 8
e. none of the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
