static private ulong fact(ulong a)
factorial = factorial * i;
static private ulong nPr(ulong n, ulong r)
return fact(n) / fact(n - r);
static private double DectoPer(double a)
static private double PertoDec(double a)
static private ulong nCr(ulong n, ulong r)
return fact(n) / (fact(n - r) * fact(r));
static private float mn(float n1, float n2, float n3, float n4, float n5)
return (n1 + n2 + n3 + n4 + n5) / 5;
public static void main()
string restart = "Chicken Nugget";
Console.WriteLine("Welcome to the Probability Calculator.");
Console.WriteLine("Press 1 for factorial");
Console.WriteLine("2 for permuations");
Console.WriteLine("3 for decimal to percent");
Console.WriteLine("4 for percent to decimal ");
Console.WriteLine("5 for combination");
Console.WriteLine("6 to find the mean for 5 numbers");
string choice = Console.ReadLine();
Console.WriteLine("What number would you ike to calculate the factorial of?");
ulong input = ulong.Parse(Console.ReadLine());
Console.WriteLine(input + "! =" + fact(input));
Console.WriteLine("how many objects do you have in total?");
ulong input1 = ulong.Parse(Console.ReadLine());
Console.WriteLine("How many objects do you want to arrange?");
ulong input2 = ulong.Parse(Console.ReadLine());
Console.WriteLine(input1 + "p" + input2 + "=" + nPr(input1, input2));
Console.WriteLine("what decimal would you like to convert to percent?");
double ans = double.Parse(Console.ReadLine());
Console.WriteLine(ans + " = " + PertoDec(ans));
Console.WriteLine("what percent would you like to convert to a decimal ");
double ans = double.Parse(Console.ReadLine());
Console.WriteLine(ans + " = " + PertoDec(ans));
Console.WriteLine("how many objects do you have in choose?");
ulong input1 = ulong.Parse(Console.ReadLine());
Console.WriteLine("How many objects do you want to arrange?");
ulong input2 = ulong.Parse(Console.ReadLine());
Console.WriteLine(input1 + "C" + input2 + "=" + nCr(input1, input2));
Console.WriteLine("Please enter a number");
float n1 = float.Parse(Console.ReadLine());
Console.WriteLine("Please enter a number");
float n2 = float.Parse(Console.ReadLine());
Console.WriteLine("Please enter a number");
float n3 = float.Parse(Console.ReadLine());
Console.WriteLine("Please enter a number");
float n4 = float.Parse(Console.ReadLine());
Console.WriteLine("Please enter a number");
float n5 = float.Parse(Console.ReadLine());
Console.WriteLine("the mean of the 5 numbers is " + mn(n1, n2, n3, n4, n5));
Console.WriteLine("Please enter an number 1 through 6");
Console.WriteLine("Press q to quit or anything else to continue the program");
restart = Console.ReadLine();