Reply
Thu 8 Dec, 2022 10:06 pm
Paste the following code into the main() method. Modify the code; so that it works (You’ll have to make 3 small modifications). It should output the value of each string in the array called colors.
the code is
using System;
class GFG
{
// Main Method
static public void Main(String[] args)
{
string[] colors = { "Green", " Red", " Blue", " Yellow", " Pink" };
for (int j = 1; j <= colors.Length; j++)
{
Console.WriteLine(colors[0]);
}
}
}
@vhu,
for (int j =
0; j
< colors.Length; j++)
{
Console.WriteLine(colors[
j]);
}