I need to get average of 3 numbers : <p>I need to fix this code but i keep getting expected unqualified -id</p>

<p>I've tried placing the brackets at different positions and changed the semicolon to a colon but nothing happened</p>

<pre><code>int main();

{int val1, val2, val3;
int avg;

cout &lt;&lt; "Please enter 3 integers, separated by spaces: "
cin &gt;&gt; val1 &gt;&gt; val2 &gt;&gt; val3;
sum = val1 + val2 + val3;
cout &lt;&lt; "The sum = " &lt;&lt; sum;
avg = val1 + val2 + val3 / 3;
cout &lt;&lt; 'The average = ' &lt;&lt; avg &lt;&lt; endl;
return 0;
}
</code></pre>

<p>I was expecting to get the average.</p>
