1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Slav-nsk [51]
3 years ago
9

Fibonacci sequence has many applications in Computer Science. Write a program to generate Fibonacci numbers as many as desired.

After the construction, you can print the sum value of the sequence. The example is below and user input is in boldface.
Engineering
2 answers:
VikaD [51]3 years ago
8 0

Answer:

The Python Code for Fibonacci Sequence is :

# Function for nth Fibonacci number  

def Fibonacci(n):  

if n<0:  

 print("Incorrect input")  

# First Fibonacci number is 0  

elif n==0:  

 return 0

# Second Fibonacci number is 1  

elif n==1:  

 return 1

else:  

 return Fibonacci(n-1)+Fibonacci(n-2)  

# Driver Program  

print(Fibonacci(9))  

Explanation:

The Fibonacci numbers are the numbers in the following integer sequence.

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..

In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation

Fn = Fn-1 + Fn-2

with seed values

F0 = 0 and F1 = 1.

IrinaK [193]3 years ago
7 0
<h2>Answer:</h2>

//import the Scanner class

import java.util.Scanner;

public class FibonacciSeries {

   

   public static void main(String[] args) {

       

       //create an object of the Scanner class

       Scanner input = new Scanner(System.in);

       

       //Prompt the user to enter the number of terms

       System.out.println("Enter the number of terms");

       

       //Store the user input in a variable

       int noOfTerms = input.nextInt();

       

       //Create a variable sum to hold the sum of the series.

       int sum = 0;

       

       //Display message

       System.out.println("First " + noOfTerms + " terms of Fibonacci numbers are");

       

       //Create a loop that goes as many times as the number of terms

       //At every term (cycle), call the fibonacci method on the term.

       //And add the number to the sum variable

       for (int i = 1; i<=noOfTerms; i++){

         System.out.println(fibonacci(i));

         sum += fibonacci(i);

       }

       

       //Display a message

       System.out.println("The sum of the above sequence is ");

       

       //Display the sum of the fibonacci series

       System.out.println(sum);

   }

   

   //Create a method fibonacci to return the nth term of the fibonacci series

   public static int fibonacci(int n){

       

       //when n = 1, the fibonacci number is 0

       if (n <= 1){

           return 0;

       }

       

       //when n = 2, the fibonacci number is 1

       else if(n == 2){

           return 1;

       }

       

       //at other terms, fibonacci number is the sum of the previous two numbers

       else {

           return fibonacci(n-1) + fibonacci(n-2);

       }

       

   }     // End of fibonacci method

   

}        // End of class declaration

<h2>Sample Output:</h2><h2></h2>

>> Enter the number of terms

<u>7</u>

>> First 7 terms of Fibonacci numbers are

0

1

1

2

3

5

8

>> The sum of the above sequence is  

20

<h2>Explanation:</h2><h2></h2>

The above code has been written in Java. It contains comments explaining important parts of the code. Please go through the code through the comments for understandability.

You might be interested in
When could you use the engineering design process in your own life?
Luda [366]

Answer:

You could use this process to make a new item or solve a problem that you could be having around the house

I hope this helps!

Explanation:

7 0
3 years ago
Estimate the maximum expected thermal conductivity for a Cermet that contains 58 vol% titanium carbide (TiC) particles in a coba
Alik [6]

Answer:

The right answer is "36.32 W/mk".

Explanation:

According to the question,

TiC = 76%

or,

      = 0.76

CO = 24%

or,

     = 0.24

Thermal conductivity of TiC,

= 26 W/mk

Thermal conductivity of CO,

= 69 W/mk

On applying the rule, we get

⇒  "K" \ of \ Cermet=(K)_{TiC} (V_f)_{TiC}+(K)_{CO} (V_m)_{CO}

On putting the given values, we get

⇒                            =(26)(0.76)+(69)(0.24)

⇒                            =19.76+16.56

⇒                            =36.32 \ W/mk

8 0
3 years ago
What is the major drawback to use whiskers as a dispersed agents in composites? a)- High price b)- Large length to diameter rati
artcher [175]

Answer: C) a&c

Explanation: Composite materials are the materials which are made up of the two or more material of different properties.They are usually having properties like high hardness,low in density,no dissolving into each other etc. Whiskers as a dispersing agent in composite materials are usually not preferred because they are expensive as well as they are not easy to disperse in the composite material.Thus option (c) is the correct answer.

7 0
3 years ago
Volume of sale (i.e., the number of parts sold) is a factorwhen determining which
nadya68 [22]

Answer: N has to be lesser than or equal to 1666.

Explanation:

Cost of parts N in FPGA = $15N

Cost of parts N in gate array = $3N + $20000

Cost of parts N in standard cell = $1N + $100000

So,

15N < 3N + 20000 lets say this is equation 1

(cost of FPGA lesser than that of gate array)

 Also. 15N < 1N + 100000  lets say this is equation 2  

(cost of FPGA lesser than that of standardcell)

Now

From equation 1

12N < 20000

N < 1666.67

From equation 2

14N < 100000

N < 7142.85

AT the same time, Both conditions must hold true

So N <= 1666 (Since N has to be an integer)

N has to be lesser than or equal to 1666.

3 0
3 years ago
A fluid of specific gravity 0.96 flows steadily in a long, vertical 0.71-in.-diameter pipe with an average velocity of 0.90 ft/s
KengaRu [80]

Answer:

0.00650 Ib s /ft^2

Explanation:

diameter ( D ) = 0.71 inches = 0.0591 ft

velocity = 0.90 ft/s ( V )

fluid specific gravity = 0.96 (62.4 )  ( x )

change in pressure ( P ) = 0 because pressure was constant

viscosity =  (change in p - X sin∅ ) D^{2} / 32 V

              = ( 0 - 0.96( 62.4) sin -90 ) * 0.0591 ^2  / 32 * 0.90

              = - 59.904 sin (-90) * 0.0035 / 28.8

              = 0.1874 / 28.8

  viscosity = 0.00650 Ib s /ft^2

8 0
3 years ago
Read 2 more answers
Other questions:
  • A dipstick is (a direct,an indirect) measurement device
    13·1 answer
  • A) A cross-section of a solid circular rod is subject to a torque of T = 3.5 kNâ‹…m. If the diameter of the rod is D = 5 cm, wha
    10·1 answer
  • A family quarantined at home in March/April 2020 has two dogs: a bull mastiff (Biggie), and a chihuahua (Smalls). Smalls has a b
    9·1 answer
  • a vehicle is in her repair with a complaint at for heating output during testing and diagnosing air is found to be trapped in th
    15·1 answer
  • Matthew wants to manufacture a large quantity of products with standardized products having less variety. Which type of producti
    5·1 answer
  • A car is traveling at 50 ft/s when the driver notices a stop sign 100 ft ahead and steps on the brake. Assuming that the deceler
    6·1 answer
  • A benefit to using the medium the author used in "Great Rock and Roll
    12·2 answers
  • Difference between theory and practice?​
    10·1 answer
  • Once you get the answer correct first i will mark you brainliest!!
    15·2 answers
  • What is the relationship between compressor work and COPR?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!