How to print string array with foreach loop in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array = { "c", "c++", "c#", "java" };

            foreach (string s in array) { 
                Console.WriteLine(s);
            }
        }
    }
}


/*
run:
  
c
c++
c#
java
 
*/

 



answered Aug 15, 2018 by avibootz

Related questions

2 answers 248 views
2 answers 256 views
1 answer 189 views
2 answers 283 views
1 answer 223 views
1 answer 148 views
148 views asked Mar 6, 2023 by avibootz
1 answer 173 views
...