From 5eb9fcc2e798fa69b1bd85feb33217896163ef23 Mon Sep 17 00:00:00 2001 From: khojianvar Date: Mon, 27 Mar 2023 12:59:16 +0500 Subject: [PATCH] Task2 is finished --- Task/Task/Program.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Task/Task/Program.cs b/Task/Task/Program.cs index a2ce029..b9064ad 100644 --- a/Task/Task/Program.cs +++ b/Task/Task/Program.cs @@ -4,7 +4,21 @@ internal class Program { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + Console.Write("Enter the number: "); + int num = int.Parse(Console.ReadLine()); + int factorial = 1; + int new_num = num; + /*for (;num!=0;) + { + factorial *= num; + num -= 1; + }*/ + while (num != 0) + { + factorial *= num; + num -= 1; + } + Console.WriteLine($"Factorial of {new_num} is: {factorial}"); } } } \ No newline at end of file