Codes/Volume 01/E0002 Even Fibonacci numbers.cpp
/*
Statement:
 Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will 
 be:

 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

 By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
*/
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will
be.



By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
Each new term in the Fibonacci sequence is generated by adding the previous two terms . By starting with 1 and 2 the first 10 terms will be . By considering the terms in the Fibonacci sequence whose values do not exceed four million find the sum of the even - valued terms .
vector<ll> fibonacciTill(ll maxVal){
    vector<ll> fibs;
    ll fnow = 0, fnxt = 1, fnxt2;
    while(fnow <= maxVal){
        fibs.push_back(fnow);
        fnxt2 = fnow + fnxt;
        fnow = fnxt;
        fnxt = fnxt2;
    }
    return fibs;
}
vector < ll > fibonacciTill ( ll maxVal ) { vector < ll > fibs ; ll fnow = 0 , fnxt = 1 , fnxt2 ; while ( fnow <= maxVal ) { fibs . push_back ( fnow ) ; fnxt2 = fnow + fnxt ; fnow = fnxt ; fnxt = fnxt2 ; } return fibs ; }
Statement:
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
Statement : Each new term in the Fibonacci sequence is generated by adding the previous two terms .