+ 1

how to write on console the elements of an array? C#

hello, how do i enter the elements of an array from the console? for example: i have an array called palette[] and I want it to have x elements, in this case, 5 elements: yellow, blue, green, orange and purple. how can i do this? thank you :^) (i’m sorry for my bad English. English is not my first language)

27th Apr 2019, 2:18 AM
Julia García
Julia García - avatar
2 ответов
+ 1
Thanks jool. Your english is good enough to be understandable. Have a look at this sample code https://code.sololearn.com/c4puOpsZsMpJ/?ref=app
27th Apr 2019, 8:16 PM
sneeze
sneeze - avatar
+ 1
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { string[] palette = {"yellow", "blue", "green", "orange", "purple"}; foreach (string name in palette) Console.WriteLine(name); } } }
28th Apr 2019, 6:00 AM
Gayan Charith Elgiriya
Gayan Charith Elgiriya - avatar