Monday, 14 May 2018

Program to print n terms of fibonacci series in c

/* program to print fibo series */
#include <stdio.h>
void main ()
{
int a=0,b=1,sum,counter=0,n ;
clrscr () ;
printf ("/n %d",a) ;
printf ("/n %d",b) ;
printf ("/n how many terms you want to print:") ;
scanf ("%d", & n) ;
while (counter<n-2)
{
sum=a+b ;
printf ("/n %d",sum) ;
a=b ;
b=sum ;
counter++ ;
}
getch () ;
}

No comments:

Post a Comment

Featured post

Kalgudi Interview Round!!

Those who cleared the second round of kalgudi got an email from exceller to complete their Kalgudi Interview Round. So here we will discuss ...