/ Undifined / 15 - WAP Fibonacci series C program using a for loop

15 - WAP Fibonacci series C program using a for loop

Fibonacci series C program using a for loop

  1. /* Fibonacci series program in C language */
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6.   int n, first = 0, second = 1, next, c;
  7.  
  8.   printf("Enter the number of terms\n");
  9.   scanf("%d", &n);
  10.  
  11.   printf("First %d terms of Fibonacci series are:\n", n);
  12.  
  13.   for (= 0; c < n; c++)
  14.   {
  15.     if (<= 1)
  16.       next = c;
  17.     else
  18.     {
  19.       next = first + second;
  20.       first = second;
  21.       second = next;
  22.     }
  23.     printf("%d\n", next);
  24.   }
  25.  
  26.   return 0;
  27. }


about author

Blogger Sens it website about blogger templates and blogger widgets you can find us on social media
Previous Post :Go to tne previous Post
Next Post:Go to tne Next Post

No comments:

Post a Comment