Doubt 1 = Why we initialized i=2 and not i=1
Multiplying by one will does not change the answer, so you can skip it. However there is no harm in running the loop from one.
Doubt 2 = What if user enter the integer as 0
Factorial of 0 is one, so if the the user inputs zero, the loop will not run and the answer will be $\textit{factorial}$ which is initialized with 1.