How to use Console.WriteLine with format in C#

1 Answer

0 votes
using System;
 
class Program
{
    static void Main()
    {
        string s1 = "c";
        string s2 = "c++";
        string s3 = "c#";
        
        int n = 9387;
 
        Console.WriteLine("{0}, {1}, {2}, {3}", s1, s2, s3, n);
    }
}
 
 
 
 
/*
run:
 
c, c++, c#, 9387
 
*/

 



answered Sep 4, 2020 by avibootz
edited Sep 5, 2020 by avibootz

Related questions

1 answer 185 views
1 answer 162 views
1 answer 147 views
1 answer 169 views
1 answer 154 views
1 answer 170 views
1 answer 129 views
129 views asked Sep 4, 2020 by avibootz
...