C Programming Code Examples C > For Loops and While Loops Code Examples Fibonacci Series in C using loop Fibonacci Series in C using loop A simple for loop to display the series. Program prompts user for the number of terms and displays the series having the same number of terms. #include<stdio.h> int main() { int count, first_term = 0, second_term = 1, next_term, j; //Ask user to input number of terms printf("Enter the number of terms:\n"); scanf("%d",&count); printf("First %d terms of Fibonacci series:\n",count); for ( j = 0 ; j < count ; j++ ) { if ( j <= 1 ) next_term = j; else { next_term = first_term + second_term; first_term = second_term; second_term = next_term; } printf("%d\n",next_term); } return 0; }