Write C Function Computes First Thirty Terms Fibonacci Series Store Computed Terms Array B Q37082568

  1. Write a C function that computes the first thirty terms of theFibonacci series. Store the computed terms in an array. Buildanother function that displays the array. The definition of theFibonacci series is as follows: F[0] = 0; F[1] = 1; F[i] = F[i-2] +F[i-1]

Solution


#include <stdio.h>void fillArray(int f[]){ int i; f[0] = 0; f[1] = 1; for(i = 2;i<30;i++){ f[i] = f[i-1]+f[i-2]; }}void printArray(int f[]){ int i; for(i = 0;i<24;i++){ printf(“%d “,f[i]); }}int

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.