Lab Mst-1: Write A Program To Display Only The Missing Terms of Fibonacci Series Up To User Specified Limit
Lab Mst-1: Write A Program To Display Only The Missing Terms of Fibonacci Series Up To User Specified Limit
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<<"NAME-SAKSHI KUMARI UID-21BCS9402"<<endl;
cout<<"Enter the no. of terms of Fibonacci series=";
cin>>n;
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++)
{
SUBJECT NAME-Object Oriented Programming using C++ SUBJECT CODE-21CSH103
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
Apply different techniques to decompose a problem and programmed a solution with its
sub modules.
Analyze and explain the behavior of simple programs involving the programming
addressed in the course.
Implement and evaluate the programs using the syntax and semantics of object-oriented
programming.
Design the solution of real-world problems in order to determine that the program
performs as expected.