How to append NewLine to strings in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = "c# ";
            string s2 = "java ";
            string s3 = "c++ ";

            s1 += Environment.NewLine + s2 + Environment.NewLine + s3;

            Console.WriteLine(s1);
        }
    }
}

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

 



answered Jan 16, 2017 by avibootz

Related questions

1 answer 121 views
1 answer 179 views
2 answers 153 views
153 views asked Jan 16, 2017 by avibootz
1 answer 188 views
1 answer 170 views
2 answers 123 views
123 views asked Nov 18, 2023 by avibootz
...