/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 411 - Problem 10: Coin Tossing */ /******************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DOS { class Program { static Random r = new Random(); static int Toss() { return r.Next(0, 2); } static void Main(string[] args) { int count = 0; for (int i = 0; i < 100; i++) { if (Toss() == 0) { Console.Write("Tail, "); count++; } else Console.Write("Head, "); } Console.WriteLine("\n\n\nHead = {0}", 100 - count); Console.WriteLine("Tail = {0}", count); Console.ReadKey(); } } }