Write a program to find the largest& smallest of three numbers. (Use inline function MAX and MIN)

C++ Programs
WAP to
generate the Fibonacci series up to user specified limit. Write all the missing
terms (e.g. 4, 6, 7, 9, 10, 11, 12, 14, 15…) also at the end.
PROGRAM CODE:
#include<iostream>
using namespace std;
int main()
{
int
n,c,first=0,second=1,next;
int
a[20],i,j=0,count=0;
cout<<"Enter
the no. of terms of Fibonacci series=";
cin>>n;
cout<<"Terms
of Fibonacci series are"<<endl;
for(c=0;c<n;c++)
{
if(c<=1)
next=c;
else
{
next=first+second;
first=second;
second=next;
}
cout<<next<<endl;
if(next-first>1)
{
for(i=first+1;
i<next; i++)
{
a[j]=i;
count++;
j++;
}
}
}
cout<<"Missing
numbers of the Fibonacci series are:"<<endl;
for(j=0;
j<count; j++)
cout<<a[j]<<endl;
return
0;
}
OUTPUT:
Comments
Post a Comment