Question: Help me finish please asap C++ or Java ! Write a program that prints the numbers that are not found in a Fibonacci sequence. Input

Help me finish please asap C++ or Java !

Write a program that prints the numbers that are not found in a Fibonacci sequence. Input from the keyboard an integer representing the number in the sequence to find. Output the appropriate nonFibonacci number. Error check negative numbers. Use a user-defined function/method. Refer to the sample output below. Sample Run:

Enter a value in the sequence: 1

The first non-Fibonacci number is: 4

Name the program: NoFiboancciXX.java or NoFibonacciXX.cpp, where XX are your initials.

#include using namespace std;

int NonFibo(int n ) { int a[1000000]={0}; int x=0; int y=1; for(;x<1000000;x=x+y,y=y+x) { if(x<1000000) a[x]=1; if(y<1000000) a[y]=1; } int count=0; for(int i=0;i<1000000;i++) { if((a[i]==0)&&(count==(n-1))) { return i; break; } else if (a[i]==0) {count++;} } }

int main() { cout<

1. Write a program that prints the numbers that are not found in a Fibonacci sequence. Input from the keyboard an integer representing the number in the sequence to find. Output the appropriate non- Fibonacci number. Error check negative numbers. Use a user-defined function/method. Refer to the sample output below. Sample Run: Enter a value in the sequence: 1 The first non-Fibonacci number is: 4 Name the program: NoFiboanccixx.java or NoFibonaccixx.cpp, where XX are your initials

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!