Advertisement
Nahid8195

Fibonacci

Jul 28th, 2021
816
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. // Fibonacchi
  2. //Mir Shamim Nahid
  3.  
  4. #include <stdio.h>
  5. int main ()
  6. {
  7.     int f[100];
  8.     int n,i;
  9.  
  10.     printf("Enter Number of input:");
  11.     scanf("%d",&n);
  12.  
  13.    f[0]=0;
  14.    f[1]=1;
  15.  
  16.    for(i=2; i<n; i++)
  17.    {
  18.        f[i]=f[i-1]+f[i-2];
  19.    }
  20.  
  21.    for(i=0;i<n;i++)
  22.    {
  23.        printf("%d ",f[i]);
  24.    }
  25.  
  26.     return 0;
  27. }
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement