static private double fact(double a)
factorial = factorial * i;
static private double DectoPer(double a)
static private double PertoDec(double a)
static private double nPr(double n, double r)
double nrfact = fact(n - r);
static private double nCr(double n, double r)
double nrfact = fact(n - r);
return (nfact) / (nrfact) * (nfact);
public static void Main()
Console.WriteLine("Please choose what you would like to calulate:");
Console.WriteLine("Press 1 to calculate Factorial");
Console.WriteLine("Press 2 to convert a Percent to a Decimal");
Console.WriteLine("Press 3 to convert a Decimal to a Percent");
Console.WriteLine("Press 4 to calculate Permutation");
Console.WriteLine("Press 5 to calculate Combination");
string choice = Console.ReadLine();
Console.WriteLine("What number would you like the factorial of?");
ulong ans1 = ulong.Parse(Console.ReadLine());
Console.WriteLine(ans1 + "! = " + fact(ans1));
Console.WriteLine("What percent would you like to convert to a decimal?");
double ans2 = double.Parse(Console.ReadLine());
Console.WriteLine(ans2 + " = " + PertoDec(ans2));
Console.WriteLine("What decimal would you like to convert to a percent?");
double ans3 = double.Parse(Console.ReadLine());
Console.WriteLine(ans3 + " = " + DectoPer(ans3) + "%");
Console.WriteLine("How many items do you have?");
double ans4 = double.Parse(Console.ReadLine());
Console.WriteLine("How many ways would you like to arrange this?");
double ans5 = double.Parse(Console.ReadLine());
Console.WriteLine(ans4 + "P" + ans5 + " = " + nPr(ans4, ans5));
Console.WriteLine("How many items do you have?");
double ans6 = double.Parse(Console.ReadLine());
Console.WriteLine("How many ways would you like to arrange this?");
double ans7 = double.Parse(Console.ReadLine());
Console.WriteLine(ans6 + "P" + ans7 + " = " + nCr(ans6, ans7));
Console.WriteLine("Press q to quit or any other key to continue.");
restart = Console.ReadLine();