I'm trying to sum integers, but I don't know where the flaw is in this code just tell me where is the flaw in this code, don't give other ways to solve this question
The output should be 6 but the code gives 4.
int SUM(int n) {
cout<<n<<endl;
if(n!=1)
return n + SUM(--n);
return n;
}
int main() {
cout<<SUM(3)<<endl;
}