What will be the output of the following C# code? [code] static void Main(string[] args) { int a = 5; int b = 10; int

What will be the output of the following C# code?
Code:
 static void Main(string[] args)
 {
     int a = 5;
     int b = 10;
     int c;
     Console.WriteLine(c = ++ a + b ++);
     Console.WriteLine(b);
     Console.ReadLine();
 }
A. 11, 10
B. 16, 10
C.
Code:
16, 11
D. 15, 11
 
Answer: c
Explanation: c = 6 + 10 = 16 and b = 11 as we know ++operator increments and then executes similarly operator++ executes and then increments.
Output:
Code:
16, 11
 

Tìm kiếm

Back
Top