Loop Operation and Recursive Functions in C

Given task;

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 1, the first 10 terms will be:
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, …
By considering the terms in the Fibonacci sequence whose values do not exceed two billion, find the number of even and odd valued terms, by:
i. Using the while() { } loop
ii. Using the do { } while() loop
iii. Using the for() { } loop
iv. Using recursive function call
For each of the alternative implementations listed above, you are supposed to print the number of even and odd Fibonacci numbers that do not exceed two billion on the screen, as follows:
15 31

Part i :  Using the while() { } loop

Part ii. Using the do { } while() loop

Part iii

Leave a Reply

Your email address will not be published. Required fields are marked *