15,884,298 members
Home / Discussions / C#

# C#

 Re: How to calculate in c# the possibility of this game OriginalGriff22-Aug-20 23:05 OriginalGriff 22-Aug-20 23:05
 Re: How to calculate in c# the possibility of this game Exoskeletor22-Aug-20 23:28 Exoskeletor 22-Aug-20 23:28
 Re: How to calculate in c# the possibility of this game Luc Pattyn23-Aug-20 12:51 Luc Pattyn 23-Aug-20 12:51
 Re: How to calculate in c# the possibility of this game Exoskeletor23-Aug-20 13:01 Exoskeletor 23-Aug-20 13:01
 Re: How to calculate in c# the possibility of this game Luc Pattyn23-Aug-20 13:03 Luc Pattyn 23-Aug-20 13:03
 Re: How to calculate in c# the possibility of this game Exoskeletor23-Aug-20 13:06 Exoskeletor 23-Aug-20 13:06
 Re: How to calculate in c# the possibility of this game trønderen23-Aug-20 13:28 trønderen 23-Aug-20 13:28
 Re: How to calculate in c# the possibility of this game Exoskeletor23-Aug-20 13:33 Exoskeletor 23-Aug-20 13:33
 that wasnt a hint!!! it appears to be the solution cause now this works ```using System.IO; using System; class Program { static void Main() { Console.WriteLine(CalculateProbabilityOfDrawNumbersFromAllNumbers(1,1)); } private static double CalculateProbabilityOfDrawNumbersFromAllNumbers(double drawNumbers, double allNumbers) { return Factorial(allNumbers) / (Factorial(drawNumbers) * Factorial(allNumbers - drawNumbers)) * (Factorial(80 - allNumbers) / (Factorial(20 - drawNumbers) * Factorial(80 - allNumbers - (20 - drawNumbers)))) / (Factorial(80) / (Factorial(20) * Factorial(80 - 20))); } private static double Factorial(double x) { double f = 1; while (x > 1) { f *= x--; } return f; } }``` im not sure why i was getting division by zero error. the int has surpass its largest number and return 0? i will use this crazy code to display it as a percentage without any unnecessary zeros in the end ```Console.WriteLine((CalculateProbabilityOfDrawNumbersFromAllNumbers(12,12) * 100).ToString("F7").TrimEnd(new Char[] { '0' } ).TrimEnd(new Char[] { '.' } )+"%"); ```modified 23-Aug-20 20:04pm.
 Re: How to calculate in c# the possibility of this game Luc Pattyn23-Aug-20 15:57 Luc Pattyn 23-Aug-20 15:57
 Re: How to calculate in c# the possibility of this game Exoskeletor24-Aug-20 0:35 Exoskeletor 24-Aug-20 0:35
 Re: How to calculate in c# the possibility of this game Richard MacCutchan24-Aug-20 1:04 Richard MacCutchan 24-Aug-20 1:04
 Re: How to calculate in c# the possibility of this game Exoskeletor24-Aug-20 1:10 Exoskeletor 24-Aug-20 1:10
 Re: How to calculate in c# the possibility of this game Eddy Vluggen24-Aug-20 12:52 Eddy Vluggen 24-Aug-20 12:52
 Re: How to calculate in c# the possibility of this game Exoskeletor24-Aug-20 23:22 Exoskeletor 24-Aug-20 23:22
 Re: How to calculate in c# the possibility of this game Luc Pattyn24-Aug-20 7:48 Luc Pattyn 24-Aug-20 7:48
 Re: How to calculate in c# the possibility of this game Exoskeletor24-Aug-20 23:22 Exoskeletor 24-Aug-20 23:22
 Re: How to calculate in c# the possibility of this game trønderen26-Aug-20 0:50 trønderen 26-Aug-20 0:50
 Re: How to calculate in c# the possibility of this game Exoskeletor23-Aug-20 19:23 Exoskeletor 23-Aug-20 19:23
 How do I load a block on a form at startup Brian_TheLion22-Aug-20 18:56 Brian_TheLion 22-Aug-20 18:56
 Re: How do I load a block on a form at startup BillWoodruff22-Aug-20 19:12 BillWoodruff 22-Aug-20 19:12
 Re: How do I load a block on a form at startup OriginalGriff22-Aug-20 20:48 OriginalGriff 22-Aug-20 20:48
 Re: How do I load a block on a form at startup Brian_TheLion23-Aug-20 14:33 Brian_TheLion 23-Aug-20 14:33
 Re: How do I load a block on a form at startup Luc Pattyn23-Aug-20 2:49 Luc Pattyn 23-Aug-20 2:49
 Re: How do I load a block on a form at startup Gerry Schmitz23-Aug-20 6:48 Gerry Schmitz 23-Aug-20 6:48
 Re: How do I load a block on a form at startup Brian_TheLion24-Aug-20 17:03 Brian_TheLion 24-Aug-20 17:03
 Last Visit: 31-Dec-99 18:00     Last Update: 23-Apr-24 9:36 Refresh ᐊ Prev1...182183184185186187188189190191 Next ᐅ