+ 2

c#::::::question in printing text

why an error is occurred when Console.WriteLine("x = {0}",x);and Console.WriteLine("y = {1}",y); statements are written in two different lines

27th Jan 2018, 5:30 AM
Keadasapoorva Rao
Keadasapoorva Rao - avatar
3 Answers
+ 13
use it: Console.Write();
27th Jan 2018, 1:00 PM
Vladimir Prokhorenko
Vladimir Prokhorenko - avatar
+ 2
Console. WriteLine ("y={1}",y); This is a new statement. It does know about the x-statement. Placeholders always should start with 0. So it must be Console.WriteLine ("y={0}",y); Although placeholders do not have to follow a specific order. Console.WriteLine ("{1}{0}",x,y); https://code.sololearn.com/c9Sy3XspIEZB/?ref=app
27th Jan 2018, 9:14 AM
sneeze
sneeze - avatar
27th Jan 2018, 7:35 AM
Dejan FrancuzšŸ„‡
Dejan FrancuzšŸ„‡ - avatar