I'm trying to input values into an array and trying to do other things with the values. But for some reason the for loop only executes it self 3 times before spitting out random numbers
Heres the code:
using System;
using static System.Console;
namespace Chapter6._2
{
class Program
{
static void Main(string[] args)
{
int[] pricesList = new int[9];
for (int i = 0; i < pricesList.Length; i++)
{
pricesList[i] = Convert.ToInt32(Read());
}
for (int i = 0; i < pricesList.Length; i++)
{
Write(pricesList[i] + " ");
}
}
}
}
I don't know what I am doing wrong but my array does not have these following numbers it keeps outputting...
Heres what the last output just generated after I entered in 3 numbers.
2 <---
3 <--- I inputted these numbers
5 <---
50 13 10 51 13 10 53 13 10 <--- ???? This is what came out after ????