C program to Print Fibonacci Series by taking user input with Arrays

In this problem, we will explain the fibonacci series, coded with arrays taking the user input.

#include<stdio.h>
int main()
{
 int n, i, num[30];

 printf("How many fibonacci numbers: ");
 scanf("%d",&n);

 num[0] = 0;
 num[1] = 1;

 for(i=2; i<n; i++)
 {
    num[i] = num[i-1] + num[i-2];
 }

 printf("\n");
 for(i=0; i<n; i++)
 {
     printf("%d ",num[i]);
 }


   return 0;
}

Program Flowchart

C fibonacci series flowchart

1 thought on “C program to Print Fibonacci Series by taking user input with Arrays”

Leave a Comment