ItsMoonLight6366 ItsMoonLight6366
  • 22-01-2021
  • Computers and Technology
contestada

Write a c++ programm that enter a number from the user and displays Fibonacci numbers from 1 to given number using function

Respuesta :

tonb
tonb tonb
  • 22-01-2021

Answer:

#include <iostream>

using namespace std;

int main()

{

   cout << "Enter number: ";

   int number;

   cin >> number;

   int prevfib = 0;

   int fib = 1;

   while (fib <= number) {

       cout << fib << " ";

       int add = prevfib;

       prevfib = fib;

       fib += add;

   }

}

Answer Link

Otras preguntas

10 40 g(x) f(x) -5 10 5 -10年 Text description for graph A. g(x)=-3 OB. g(x)=(x-3)² C. g(x) = (x+3)² OD. g(x) = x²+3
Drag the phrase to indicate which fossil fuel it describes
Help with this please
Constructing Normal Quantile Plots. Use the given data values to identify the corresponding z scores that are used for a normal quantile plot; then identify the
write an Email to your friend suggesting him/her Something worth in to do Somethin Completeing Cass 12 In our own Cont Country ofter​
what was the exterme nationalism for soviet union
The tile floor in a restaurant is being replaced. What is the total area of the new tile floor in the restaurant?
he following is a December 31, 2024, post-closing trial balance for Almway Corporation. Account Title Debits Credits Cash $ 79,000 Investment in equity secur
Here is a histogram showing the times taken to complete a task. Estimate the percentage of people who took less than 30 seconds to complete the task. Give your
La question 2 Sa m'aiderai si quelqu'un répond avant demain