CSharp - Write program to Sum the Entered Numbers until 0 input value

Requirements

The user is entering numbers with the last one being 0.

The program displays the sum of all the entered numbers.

Hint

You have to keep the sum in a variable and to add every entered number into that variable.

As soon as the user terminates the input, the variable will contain the overall sum of all the entered values.

Demo

using System;
class Program//  w w  w  .j ava 2  s.  c om
{
    static void Main(string[] args)
    {
        // Preparations 
        int sum = 0;
        int number;

        // Entering numbers until zero 
        do
        {
            // Input 
            Console.Write("Enter a number (0 = end): ");
            string input = Console.ReadLine();
            number = Convert.ToInt32(input);

            // Adding to intermediate sum 
            sum += number;

        } while (number != 0);
        // Output 
        Console.WriteLine("Sum of entered numbers is: " + sum.ToString());

    }
}

Result