2021-09-02 08:31:01 -03:00

28 lines
418 B
C#

using System;
namespace exercicios
{
class Exercicio2{
public static void Init()
{
int n;
Console.WriteLine("Insert a value");
n = int.Parse(Console.ReadLine());
Console.WriteLine("{0}! = {1}",n,calcularFatorial(n));
}
static int calcularFatorial(int n)
{
int fat = 1;
for(int i = 1; i <= n; i++)
{
fat *= i;
}
return fat;
}
}
}