error C2143: syntax error : missing ';' before 'if'
<pre><code>    #include &lt;iostream&gt;
    using namespace std;

    int factor(int n);

    int main()
    { 
        int f,n;

    // Get user input

        cout &lt;&lt; "Enter an integer: ";
        cin &gt;&gt; n;

    // Call factorial function

        f = factor(n);

    // Output results

        cout &lt;&lt; n &lt;&lt; "! = " &lt;&lt; f &lt;&lt; endl;

        int factor (int n)
            if(n &lt;=1)
            {
             return 1;
            }
            else
            {
             int c = n * (n-1);
             return c;
            }
     };
</code></pre>

<p>I am getting an error C2143: syntax error : missing ';' before 'if'
I was curious if I was missing something simple. I am fairly new to C++. </p>
