How do I restrict the print out of this sequence to just N or so terms? I am wanting to print no more than 30 or so and at the moment im getting the program running continuously
#include <iostream>
#include <stdio.h>
usingnamespace std;
int main()
{
int N;
do {
cout << "Enter the number of terms you wish to print (N):" << endl;
cin >> N;
} while ( (N == 0)) ;
for (float i=1; i<=10; i=1+(1/i))
printf ("%12.10g" , i );
return 0;
}
So x > 1/9 would make that true?
i tends to 1.6180... as the sequence progresses so my i<=10 is never reached.
what would the condition be? so do I need to make a new variable x for the condition?
thanks for your help