How do I get this code to repeat 100 times while storing and averaging the number of times a six is rolled?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Playing_Around { class MainClass { public static void Main(string[] args) { Random numberGen = new Random(); int numberOfAttempts = 0; int attempt = 0; while (attempt != 6) { attempt = numberGen.Next(1, 7); Console.WriteLine("Tom Rolled: " + attempt + "."); numberOfAttempts++; } Console.WriteLine ("It took Tom " + numberOfAttempts + " attempts to roll a 6."); Console.ReadKey(); } } } Any help would be appreciated. I am curious how I could get this code to repeat 100 times while storing and averaging the number of times a six is rolled? Sorry, have only been learning code for a couple of weeks. :)