B

Babita • 7.70K Points
Tutor III

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

Code:
static void Main(string[] args)
  {
      int i ;
      for (i = 0; i < 5; i++)
      {
          int j = 0;
          j += i; 
          Console. WriteLine(j);
      }
      Console. WriteLine( i * j);
      Console. ReadLine();
  }
  • (A) 0, 1, 6, 18, 40
  • (B) 0, 1, 5, 20, 30
  • (C) Compile time error
  • (D) 0, 1, 2, 3, 4, 5
  • Correct Answer - Option(C)
  • Views: 130
  • Filed under category C#

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics