0
   

I need an answer for the question below. Please help ASAP. Thank you. It is in C# visual studio

 
 
vhu
 
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]);

}



}

}

  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 217 • Replies: 2

 
engineer
 
  4  
Reply Thu 8 Dec, 2022 11:16 pm
@vhu,
for (int j = 0; j < colors.Length; j++)

{

Console.WriteLine(colors[j]);

}
vhu
 
  1  
Reply Fri 9 Dec, 2022 07:19 pm
@engineer,
Thank you so much
0 Replies
 
 

 
  1. Forums
  2. » I need an answer for the question below. Please help ASAP. Thank you. It is in C# visual studio
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.22 seconds on 07/08/2024 at 03:05:54