What will be the output of the following C# code? | Question 11

45. What will be the output of the following C# code?

using System;

class Program {
  public static void Main() {
    int i = 10;
    Console.WriteLine(i++);
  }
}
  1. 10
  2. 11
  3. 12
  4. Error

Answer: A) 10

Explanation:

The statement i++ is a post-increment operation, and it increases the value of i after evaluating the Console.WriteLine() statement. Thus, 10 will be printed.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.