Anyone care to explain for curiosity's sake why this is the case? Thanks a bunch.

//A program which inputs an integer value, checks that it is positive, and //outputs its factorial, using the formulas: // factorial(0) = 1 // factorial(n) = n * factorial(n-1) //Author- SB //Date- 10/22/08 #include <iostream> using namespace std; int main (void) { double n; //user-inputted number to take factorial of int factorial; //keeps the running factorial cout << "Enter a positive integer: "; cin >> n; if ( n >= 0 ) { for (int i = 0; i <= n; i++) { if (i == 0) factorial = 1; else factorial = factorial * i; } cout << "The factorial of " << n << " is " << factorial << endl; } else { cout << "That is not a positive integer\n"; } }