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 ulong nCr(ulong n, ulong r)
return fact(n) / fact(n - r) * fact(r);
static private decimal PtD(decimal p)
static private decimal DtP(decimal d)
static private decimal mean(decimal a, decimal b, decimal c, decimal d, decimal e)
public static void Main()
string restart = "Chicken Nugget";
Console.WriteLine("Stat Calculator.");
Console.WriteLine("Press 1 for factorial, 2 for permuations, 3 for combination.");
Console.WriteLine("4 for Percent to Decimal, 5 for Decimal to Percent, 6 for mean.");
string choice = Console.ReadLine();
Console.WriteLine("What number would you like 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("Press q to quit or anything else to continue the program.");
restart = Console.ReadLine();
Console.WriteLine("What is your percent that you want as a decimal? (No need to add %)");
ulong input3 = ulong.Parse(Console.ReadLine());
Console.WriteLine(input3 + " as a decimal is: " + PtD(input3));
Console.WriteLine("What is your decimal that you want to be a percent?");
decimal input4 = decimal.Parse(Console.ReadLine());
Console.WriteLine(input4 + " as a percent is: " + DtP(input4) + "%");
Console.WriteLine("Please enter the 5 numbers you want the mean of");
decimal input5 = decimal.Parse(Console.ReadLine());
decimal input6 = decimal.Parse(Console.ReadLine());
decimal input7 = decimal.Parse(Console.ReadLine());
decimal input8 = decimal.Parse(Console.ReadLine());
decimal input9 = decimal.Parse(Console.ReadLine());
Console.WriteLine("The mean of all 5 numbers is: " + mean(input5, input6, input7, input8, input9));
Console.WriteLine("Type 'q' to quit, type anything else to restart");
restart = Console.ReadLine();