CSharp examples for Language Basics:do while
Do while loop until the random number is six
using System;// w w w. j a v a 2 s . c om using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { // Random number generator Random randomNumbers = new Random(); // Throwing as long as we have six int thrown; do { thrown = randomNumbers.Next(1, 6 + 1); Console.WriteLine(thrown); } while (thrown == 6); } }