Take the 2-minute tour ×  Here is my implementation of Problem
25 - Project Euler (see comments in code for explanation of how
it works):  #include <iostream> //Declare headers and use
correct namespace #include <math.h>  using namespace std;
//Variables for the equation F_n(newTerm) = F_n-1(prevTerm) +
Fn_2(currentTerm) unsigned long long newTerm = 0; unsigned long
long prevTerm = 1; //F_1 initially = 1 unsigned long long
currentTerm = 1; //F_2 initially = 2  unsigned long long termNo
= 2; //Current number for the term  void getNextTerms() {
//Iterates through the Fib sequence, by changing the global
variables.     newTerm = prevTerm + currentTerm; //First run:
newTerm = 2     unsigned long long temp = currentTerm; //temp =
1     currentTerm = newTerm; //currentTerm = 2     prevTerm =
temp; //prevTerm = 1     termNo++; //termNo = 3  unsigned long
long getLength(unsigned long long number) //Returns the length
of the number     unsigned long long length = 0;     while
(number >= 1) {         number = number /