Program in c++ to print febonacci series upto 100 using while loop.
//wap in c++ to print febonacci series upto 100 using while loop.
Coding:-
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=1,b=0,c;
c=a+b;
cout<<c;
while(c<=100)
{
a=b;
b=c;
c=a+b;
cout<<" "<<c;
}
getch();
}
Output:-
No comments:
Post a Comment