The point is that to find the factorial of a given number and display the result via a parameter.
I'm a noob in sharp, please explain if something is done wrong. Thank you!
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CustomMethodsOfClass { class Program { static void Factorial1(int number) { int factorial = 1; for (int i = 1; i <= number; i++) { factorial *= i; if (i == number) { Console.Write("{0}", i); } else { Console.Write("{0} * ", i); } } Console.Write(" = {0}", factorial); Console.ReadKey(); } static void Main(string[] args) { Console.Write("Enter number : "); int number = int.Parse(Console.ReadLine()); Factorial1(number); } } }