need help again!

so i need to make a adding loop program that needs to show these no.
1 2 4 7 11 16 32 39 47 56 66
i tried n=n+(n+1) but the results is so far...
please help :D

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 int main()
{
	int n;
	cout<<"Enter the number>";
	cin>>n;

	while(n<=66){
		cout<<n<<",";
		n=n+1;
		n=n+1;
	}

	cout<<"END \n";
	return 0;
}
closed account (28poGNh0)
I think your sequence is wrong maybe you want to write this one 1 2 4 7 11 16 22 29 37 46 56 67

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# include <iostream>
using namespace std;

int main()
{
    int sum = 1;
    for(int i=1;i<13;i++)
    {
        cout << sum << " ";
        sum += i;
    }
    
    return 0;
}
thanks dude!
that really help a lot and i just looked at my assignment and your right...
a minor typing prob...
thanks again...
:D
Topic archived. No new replies allowed.