What's wrong with my output?

I'm trying to write a program that shows the output of the summation formula from k=0 to n C_(n+1)= ∑ C_(k)*C_(n-k).
Here's my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>

#include <cmath>



using namespace std;



int main(){



int n;

cout << "Enter n " << endl;

cin  >> n;



int C[n];



C[0] = 1;

C[1] = 1;



cout << C[0] << " ";

cout << C[1] << " ";



for (int i = 2; i < n; i++){

   for (int j = 0; j < i; j++){

         int sum = sum + (C[j]) * (C[i-j]);

         cout << sum << " ";

         sum = C[i+1];

   }

}



return 0;

}


My output is:
1 1 4201053 19463933 38927864 2686677 2686677 5373344 1946380 73 19463980
Your problem was explained to you in the other thread you posted about this problem yesterday. Why did you decide to ignore the explanation you were given? And why have you posted a duplicate thread to ask the exact same question?
Topic archived. No new replies allowed.