Press Ctrl + C to copy text.

The command Console.WriteLine() prints its content to the output window.

When the value of iSpeed is 1, it prints Distance Traveled: 55 in the window.


using System;

namespace XoaX {
    class Program {
        static void Main(string[] args) {
            // A simple while loop
            int iSpeed = 10;
            int iDistance = 0;
            while (iSpeed > 0) {
                iDistance += iSpeed;
                Console.WriteLine("Distance Traveled: " + iDistance);
                --iSpeed;
            }
        }
    }
}

Distance Traveled: 10
Distance Traveled: 19
Distance Traveled: 27
Distance Traveled: 34
Distance Traveled: 40
Distance Traveled: 45
Distance Traveled: 49
Distance Traveled: 52
Distance Traveled: 54
Distance Traveled: 55
Press any key to continue . . .