I am required to compute all Lucas numbers up to a certain number. To keep track of a summation, more specifically, the summation of all Lucas numbers you have encountered up to that point.

A small example: If the user inputs a bound of 23: Lucas numbers up to 23 are: 2,1,3,4,7,11,18. Hence the sum is 2+1+3+4+7+11+18=46

Here's what I got:

else if (choice == 3) {

int a=2;

int b=1;

int c=3;

int bound, sum, i;

cout << "Plese enter the upper bound of the summation you are looking for:" << endl;

cin>>bound;

if (bound< 0) cout << "Only Posiive Numbers are accepted\n\n";

else{

for(i=1;c<=sum;i++)

{

a=b;

b=c;

c=a+b;

sum=sum+c;

}

cout << sum << " is the summation of all numbers until " << bound << endl;

} }