adplus-dvertising
frame-decoration

Question

Select the output for the following set of code:
static void Main(string[] args)
 {
     int i, s = 0;
     for (i = 1; i <= 10; s = s + i, i++);
     {
         Console.WriteLine(s);
     }
     Console.ReadLine();
 }

a.

Code report error

b.

Code runs in infinite loop condition

c.

Code gives output as 0 1 3 6 10 15 21 28 36 45

d.

Code give output as 55

Answer: (d).Code give output as 55

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Select the output for the following set of code: