
Kevin C. answered 12/16/22
Experienced Computer Programmer Looking to Share Knowledge
This should work (see below).
First, j should be equal to 0 not 1 when the for loop starts
Second, colors.Length should be less than (<), not less than or equal to (<=)
Third, Console.WriteLine(colors[0]) should be Console.WriteLine(colors[j]) otherwise the color "Green" would be the only thing printed.
static public void Main(String[] args)
{
string[] colors = { "Green", " Red", " Blue", " Yellow", " Pink" };
for (int j = 0; j < colors.Length; j++)
{
Console.WriteLine(colors[j]);
}
}