05.Calculate 1 + 1!/X + 2!/X2 + … + N!/XN

using System;

class CalculateFactoriel
{
    static void Main()
    {
        //input
        Console.Write("Enter number for facturiel:n=");
        int numN = int.Parse(Console.ReadLine());
        if (numN < 0)
        {
            Console.WriteLine("Invalid range!");
            Console.WriteLine("\n");
            return;
        }
        Console.Write("Enter number for x=");
        int numX = int.Parse(Console.ReadLine());
        Console.WriteLine("\n");
        if (numX==0)
        {
            Console.WriteLine("Invalid range!");
            Console.WriteLine("\n");    
            return;
        }
        //logic
        double sumNum = 0;
        int factoriel = 1;
        int oldX = 0;
         oldX =numX;
        double oldValue=0;
        double sumTotal = 0;
        double lastValue = 0;
        for (int i = 1, j=1; i <numN; i++)
        {
            oldValue=((double)factoriel/(double)numX);
            sumNum=sumNum+oldValue;
            j++;
            factoriel = factoriel * j;
            numX = numX * oldX;
        }
        lastValue=((double)(factoriel)/(double)numX);
        sumTotal = 1 + sumNum + lastValue;
        //output
        Console.WriteLine("{0:F5}",sumTotal);
    }
}