CSharp_Programs
CSharp_Programs
using System;
class Program
{
static void Main()
{
// Program 1: Calculate Factorial
Console.Write("Enter a number to find its factorial: ");
int num = Convert.ToInt32(Console.ReadLine());
int factorial = 1;
for (int i = 1; i <= num; i++)
{
factorial *= i;
}
Console.WriteLine("Factorial of " + num + " is " + factorial + "\n");