Fibonacci Sequence using C
Fibonacci Sequence using C
This program will produce an inputted number of terms of the Fibonacci Sequence using C Programming Language
C
#include<stdio.h>
int main() {
int count, first_num = 0, second_num = 1, next_num, i;
printf("Enter the number of terms:\n"); scanf("%d",&count);
printf("First %d terms of Fibonacci series:\n",count);
for ( i = 0 ; i < count ; i++ ) {
if ( i <= 1 ) next_num = i;
else { next_num = first_num + second_num; first_num = second_num; second_num = next_num; }
printf("%d\n",next_num); }
return 0; }
Share with Friends









thanks for sharing this nice inforamtion , here is more info about trending cloud computing courses for readers to know AWS Training in chennai
ReplyDelete