For this second part of the Quiz, we had to do the Fibonacci sequence, where the user gives a number and the Fibonacci sequence will end on the users number. At first I intended to use a Do, While function where we had two counters, one initialized in 0 and another in 1, and each time the loop repeated the counters will add 1 until it reached the number the user placed in.
But after some trying, it didn’t worked, so I called Christian to ask him for help, he told me he hadn’t used any do, or while, and showed me how to do it that way, this time I tryed as he told me and it did work, so I left it how he told me.
My base function was something like this:
int Fib (int cont1, int cont2, int x) {
int x, int cont1==0, int cont2==1
do{
Fib= (cont1+cont2)
while (cont2==x)
Something like that, but it didn’t work, so I changed it to this one. Found HERE
And the process in Cygwin, in which I wanted to know until what number the programm would work without any trouble. I found out that in 50, the numbers came out negative, and by number 300, the computer has not given me an answer yet.
Quiz#3 Part#2 by canadamike17 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.