Popular Posts

27.Write a program to show the first 11 numbers of febonacci series .

27.Write a program to show the first 11 numbers of febonacci series .


#include
#include
int main()
{
clrscr();
int n,s1,s2,i,fn;
cout<<"Enter value of n: "; cin>>n;
if(n<=1)
cout< else
{
s1=0,s2=1;
cout<<"Output: "< for(i=2;i<=n;i++)
{
fn=s1+s2;
cout< s1=s2;
s2=fn;
}
}
getch();
return 0;
}
Output:
Enter value of n: 10
Output: 0 1 1 2 3 5 8 13 21 34 55

No comments: