Advertisement
yoyo106

Fibonacci's Series

Apr 30th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int i, n, F1 = 0, F2 = 1, Fn;
  5.  
  6.     printf("Enter the number of terms: ");
  7.     scanf("%d", &n);
  8.  
  9.     printf("Fibonacci Series: ");
  10.  
  11.     for (i = 1; i <= n; ++i)
  12.     {
  13.         printf("%d ", F1);
  14.         Fn= F1 + F2;
  15.         F1 = F2;
  16.         F2 = Fn;
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement