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

Please help with 41 ASAP please
​(Bond valuation) The 7​-year ​$1,000 par bonds of Vail Inc. pay 9 percent interest. The​ market's required yield to maturity on a​ comparable-risk bond is 8
Which of the following is a coterminal angle between 0 and 360° for-1045? A -315° B 35 C 215° D 325°
How was Grenfell able to survive adrift on an ice pan
write equations to model the populations for each state use in for the population of Michigan I for the population of Indiana and T for time in years after 2000
If is possible to include new product in CPI calculation 1 point yes no
C(0, 5), D(4, 7), E(5, 4), F(1, 2); Slope Formula
Find the indicated function values. F(-4)= F(0)= F(1)= ✓
Hhhhhh hhh knlkgb gfgf hoping
i need to know how to get to Ai