0

What is the output of this code:

int a = 2; int b = 4; Console.Write(a); Console.Write(b);

27th Mar 2020, 6:34 PM
Naomi
2 ответов
+ 1
On the same line 24
27th Mar 2020, 6:49 PM
Mohammed Azam
+ 1
@Naomi The reason why it is 24, because Console.Write does not contain a new line at the end which would cause the next line of output to be on its own line.. If the exercise had been int a = 2; int b = 4; Console.WriteLine(a); Console.WriteLIne(b); Then the output would be 2 4 alternatively, they could have written it like Console.Write(
quot;{a}{b}"); which yields the same output as the code in your question. 24
28th Mar 2020, 1:20 AM
laura