--Originally published at Tec Life
So the problem was make to a program to do a fibonacci serie, so in order to do it I search on internet what a fibonacci serie is, and I found that is a serie that sum the two last number and converted in a new one like 2 + 3 = 5 then the next number will be 5 + 3 = 8 and like that until ends, so in order to not crash my computer I put in the main that the user write how many digits the serie would have :).
I made two programs that does the same thing, the only deference is that one uses functions and the other not.
In the program with the function I start writing my function starting on 0 that in case that the user type 0 or 1 is going to return me that number, and in case that the condition doesn’t be true then is going to return me the number – 2 + the number -1 making a serie, but that only is going to one time, so I use a do while to print all the values of the serie, then I use a for to make all the serie appears and thats all :).
And in the other program because the first to number there are not going to repeat I printed first with a cout and then I use my for to start and finish the serie depending the conditions.
And here is and image of jumping corgi in the snow :).
Have fun
Image from: http://www.artifexbalear.org/img/fibonac8g.jpg and http://buzzsharer.com/wp-content/uploads/2015/06/jumping-corgi-winter.jpg