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 180 views
1 answer 159 views
1 answer 143 views
1 answer 165 views
1 answer 152 views
1 answer 164 views
1 answer 124 views
124 views asked Sep 4, 2020 by avibootz
...