How to declare and initialize array in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        int[] array = new int[] { 4, 9, 0, 8, 5, 3 };

        foreach (int n in array) {
            Console.WriteLine(n);
        }
    }
}




/*
run:

4
9
0
8
5
3

*/

 



answered Jul 29, 2021 by avibootz

Related questions

1 answer 148 views
2 answers 213 views
5 answers 329 views
...