Repeat until 0 (Use Do While) Learn programming C# Sharp

Lesson:

Flow Control


Exercise:

Repeat until 0 (Use Do While) 11


Objetive:

Create a C# program to ask the user for a number "x" and display 10*x. It must repeat until the user enters 0 (using "do-while").


Code:

using System;
public class Exercise21
{
    public static void Main()
    {
        int number;

        do
        {
            Console.Write("Enter a number: ");
            number = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(number * 10);
        }
        while (number != 0);
    }
}