Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

40,026 questions

51,982 answers

573 users

How to print array in C#

4 Answers

0 votes
using System;

class Program
{
    static void Main() {
        int[] arr = {3, 5, 6, 9, 0, 1}; 
           
        foreach (int n in arr) {
           Console.Write(n + " ");
        }
    }
}



/*
run:

3 5 6 9 0 1 

*/

 



answered Aug 1, 2021 by avibootz
0 votes
using System;
 
class Program
{
    static void Main() {
        int[] arr = {3, 5, 6, 9, 0, 1}; 
            
        Console.WriteLine(String.Join(" ", arr));
    }
}
 
 
 
/*
run:
 
3 5 6 9 0 1
 
*/

 



answered Dec 12, 2021 by avibootz
0 votes
using System;
 
class Program
{
    static void Main() {
        int[] arr = {23, 9, 0, 87, 16, 98};
         
        for (int i = 0; i < arr.Length; i++)
            Console.WriteLine(arr[i]);
    }
}
 
 
 
 
/*
run:
 
23
9
0
87
16
98
 
*/

 



answered Apr 19, 2024 by avibootz
0 votes
using System;
 
class Program
{
    static void Main() {
        int[] arr = {23, 9, 0, 87, 16, 98};
         
        Array.ForEach(arr, Console.WriteLine);
    }
}
 
 
 
 
/*
run:
 
23
9
0
87
16
98
 
*/

 



answered Apr 19, 2024 by avibootz

Related questions

1 answer 67 views
1 answer 63 views
4 answers 160 views
160 views asked Mar 11, 2023 by avibootz
2 answers 93 views
93 views asked Feb 1, 2023 by avibootz
1 answer 105 views
...