3 ms·
Easy if you have a loaded coin. enum Side { Heads, Tails } void Main() { Func<Side> generator = () => { return Side.Heads; }; int heads = 0; while (head
by rikkus 13y ago
Easy if you have a loaded coin.
enum Side
{
Heads,
Tails
}
void Main()
{
Func<Side> generator = () => { return Side.Heads; };
int heads = 0;
while (heads < 76)
{
if (generator() == Side.Heads)
++heads;
else
heads = 0;
}
Console.WriteLine("Got {0} heads in row.", heads);
}
- rikkus 13y agoNote to self: Jokes and/or code not welcome on HN.