Code:I attempted to post this same request earlier but i am not sure if it went through. I appologise for dublication but, I need help please.
// factorial program
#include <iostream>
using namespace std;
int factorial(int num);
int main(){
int n;
cout << "Enter a number and press ENTER: "
cin >> n;
cout << " Factorial of this number is: " << factorial(n);
return 0;
}
int factorial(int n){
int i;
int fact = 0;
for(i = 0; i <= n; i++)
fact = fact * i;
return fact;
}
although the program runs without an error message it produces zero for a result.