Use the Fibonacci IPO and Algorithm and alter them so that y
Use the Fibonacci IPO and Algorithm and alter them so that you allow the user to enter two starting numbers and a choice of a maximum value not to exceed, or a total count that the sequence of numbers must not exceed. Your algorithm must not accept a beginning pair that is not in the Fibonacci sequence. ie. not a sequential pair in the set (0,1,1,2,3,5,8,13,21,34,56,90,146, ……) Your logic must repeat the selection of a pair until the user selects a correct pair. Allow the user to repeat the program until they wish to exit.
Use the Fibonacci IPO and Algorithm and alter them so that you allow the user to enter two starting numbers and a choice of a maximum value not to exceed, or a total count that the sequence of numbers must not exceed. Your algorithm must not accept a beginning pair that is not in the Fibonacci sequence. ie. not a sequential pair in the set (0,1,1,2,3,5,8,13,21,34,56,90,146, ……) Your logic must repeat the selection of a pair until the user selects a correct pair. Allow the user to repeat the program until they wish to exit.
Use the Fibonacci IPO and Algorithm and alter them so that you allow the user to enter two starting numbers and a choice of a maximum value not to exceed, or a total count that the sequence of numbers must not exceed. Your algorithm must not accept a beginning pair that is not in the Fibonacci sequence. ie. not a sequential pair in the set (0,1,1,2,3,5,8,13,21,34,56,90,146, ……) Your logic must repeat the selection of a pair until the user selects a correct pair. Allow the user to repeat the program until they wish to exit.
Solution
#include <iostream>
using namespace std;
int main()
{
int number1,number2,number3,max;
cout<<\"\ Enter two starting numbers which are in the fibonacci series\";
cin>>number1; //input starting numbers
cin>>number2;
cout<<\"\ Enter maximum value not to exceed\";
cin>>max; //input maximum value of a term in fibonacci series
cout<<\"\ Fibonacci series:\ \";
cout<<number1<<\"\\t\"<<number2<<\"\\t\";
while(number1<=max)
{
number3=number1 + number2;
if(number3>max)
break;
cout<<number3<<\"\\t\";
number1 = number2;
number2 = number3;
;
}
return 0;
}
Output:
Success time: 0 memory: 3472 signal:0
