B

Babita • 7.70K Points
Tutor III

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

Code:
class Program
 {
     static void Main(string[] args)
     {
         int i ;
         for ( i = 0; i < 5; i++)
         {
             int j = 0;
             j += i; 
             Console. WriteLine(j);
         }
         Console. WriteLine(i);
         Console. ReadLine();
     }
 }
  • (A) 0, 1, 2, 3, 4, 5, 6
  • (B) 0, 1, 2, 3, 4, 5
  • (C) 0, 1, 2, 3, 4
  • (D) 0, 1, 2, 3
  • Correct Answer - Option(B)
  • Views: 127
  • 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