Answers for "factorial c#"

C#
0

factorial c#

Console.WriteLine("Enter factorial value : ");
            var factorialvalue = Console.ReadLine();
            var tempfactvalue = 1;
            bool isnumber = double.TryParse(factorialvalue, out double n);

            if (isnumber && double.Parse(factorialvalue)>0)
            {
                for (int i = 0; i < double.Parse(factorialvalue); i++)
                {
                    tempfactvalue += (tempfactvalue * i);
                }
            }
            else { Console.WriteLine("non numeric / negative value"); }
            Console.WriteLine("factorial value :" + tempfactvalue);
            Console.ReadLine();
Posted by: Guest on July-21-2021

C# Answers by Framework

Browse Popular Code Answers by Language