all above are correct. i would like to give explanation in different way.
syntax of writeline is :
Console.WriteLine("string to be printed");
but if u have any value of a variable to be printed then u need to provide it to WriteLine somehow.
for that v have another syntax:
Console.WriteLine("<string to="" be="" printed="">",<variables whose="" value="" is="" to="" be="" printed="">);
now the list contains variable names each separated by comma(,)
WriteLine identifies each variable in the list by its position i.e.
first variable in the list has index 0
second variable in the list has index 1
and so on.
but to print the value of the variable, it need to b included in the "string to be printed" section of WriteLine .
we provide this by using the index and to notify the method that it is index and not a character to be printed we provide the index within "{}"(braces)
so to print first variable in the list v provide index 0[i.e. we write {0} within "string to be printed"]
the value of variable will b printed in position where {} is positioned.
eg:-
Console.WriteLine("{0} + {1} = {2}", a, b, (a+b));