factorial=factorial*i is what it should be or else you are just multiplying by number which is a constant.

EDIT: You should also initialize factorial to equal 1 before you use it. Otherwise it...