I'm having trouble with the code below. I'm supposed to write a function but I wanted to get the basics down first and I don't understand why my code below isn't working. Any help would be greatly appreciated.
//Write a function that returns the sum of the series 1! + 2!
// + 3! + 4! + ... + n! where n is an integer passed to the
//function as an argument.
#include <iostream>
using namespace std;
int Sum(int n)
{
return n;
}
int main(void)
{
int n=1;
int i=1;
int x=1;
int fSum=0;
int fFactorial=1;
cout << " Enter an integer. " << endl;
cin >> n;
for (i=1;i<=n;i++)
{
fFactorial=i;
for (x=1;x<i;x++);
{
fFactorial=fFactorial*x;
}