Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 5 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 15 Sep 2017 My Price 8.00

Fibonacci sequence

In C++: By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two; for example, the first 6 Fibonacci numbers are 0, 1, 1, 2, 3, 5. Write a program that asks the user for a number between 5 and 20 (inclusive) and then displays that many Fibonacci numbers. You must use a loop to calculate this! DonA????1t just cout the answer for each of the 15 possible answers. Also: Note that there is no last comma in the list.

Example of runs:

Image for In C++: By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number

Image for In C++: By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number

Here's my code so far:

#include <iostream>
#include <cstdlib>
using namespace std;

int main(){
   int x = 0;
   int fibNum = 0;

   cout << "How many Fibonacci numbers do you want? <5 to 20>: ";
   cin >> fibNum;

   while(x <= fibNum){
       x = x +1;
       cout << x << ", ";
   }
  


   return 0;
}

I can't get it to print out: 0, 1, 1, and etc. And I can't get it to not print a ',' at the last number.

Answers

(5)
Status NEW Posted 15 Sep 2017 01:09 PM My Price 8.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)