-3
int a=10,b=20;

console.writeline(a);
console.writeline(b);

I want to use only one console.writeline();

I use code below but doesn't work

console.writeline(a,b);
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
Maasoud Asadi
  • 61
  • 4
  • 8
  • 6
    In the future, please use a meaningful question title (I have removed your emoticons) and format your code using the formatting tools in the editor. – D Stanley Feb 11 '15 at 15:52

2 Answers2

9

What you need is this:

Console.Writeline("{0}{1}", a, b);
Undo
  • 25,519
  • 37
  • 106
  • 129
Fredou
  • 19,848
  • 10
  • 58
  • 113
-1

Use:

Console.WriteLine(string.Format("{0},{1}", a, b));
Undo
  • 25,519
  • 37
  • 106
  • 129
komluk
  • 437
  • 4
  • 18