I wrote a program to calculate factorial in c++, but when I compile and run the code, I get some long numbers, for example when I calculate the factorial of 12 I got 4.79002e+08 instead of 479001600.
 #include <iostream>
int main()
{
    int n;
    long double factorial = 1.0;
    std::cout << "Enter a positive integer: ";
    std::cin >> n;
    if (n < 0)
        std::cout << "Error! Factorial of a negative number doesn't exist.";
    else
    {
        for (int i = 1; i <= n; i++)
        {
            factorial *= i;
        }
        std::cout << "Factorial of " << n << " = " << factorial;
    }
    return 0;
}
Note the OS is: ubuntu 20.4
 
    