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
A furniture manufacturer purchases a drill press machine enabled with 5G and edge computing capabilities to keep the machine ope
Andreas93 [3]

A lot of manufacturer often uses 5G machines. How these capabilities could help improve safety of the operators is that it does includes an emergency switch for the operator so that one can manually shut off when needed.

<h3>Edge computing with 5G</h3>

  • The edge computing along with 5G network and IoT devices can help put together  different safety features and limitations and on can use them to known the unsafe action and also data can be communicated.

Edge computing when use with 5G produces good opportunities in all industry. It is known to help bring computation and data storage close to where data is been produced and it enable good data control, reduced costs, etc.

Learn more about 5G network from

brainly.com/question/24664177

8 0
2 years ago
Suppose the working pressure for a boiler is 10 psig, then what is the corresponding absolute pressure?
yanalaym [24]

Answer:

The corresponding absolute pressure of the boiler is 24.696 pounds per square inch.

Explanation:

From Fluid Mechanics, we remember that absolute pressure (p_{abs}), measured in pounds per square inch, is the sum of the atmospheric pressure and the working pressure (gauge pressure). That is:

p_{abs} = p_{atm}+p_{g} (1)

Where:

p_{atm} - Atmospheric pressure, measured in pounds per square inch.

p_{g} - Working pressured of the boiler (gauge pressure), measured in pounds per square inch.

If we suppose that p_{atm} = 14.696\,psi and p_{g} = 10\,psi, then the absolute pressure is:

p_{abs} = 14.696\,psi+10\,psi

p_{abs} = 24.696\,psi

The corresponding absolute pressure of the boiler is 24.696 pounds per square inch.

8 0
2 years ago
with a digital system, if you have measured incorrectly and use too low of a kvp for adequate penetration, what do you need to d
Lubov Fominskaja [6]

The x-ray beam's penetrating power is regulated by kVp (beam quality). Every time an exposure is conducted, the x-rays need to be powerful (enough) to sufficiently penetrate through the target area.

<h3>How does kVp impact the exposure to digital receptors?</h3>

The radiation's penetration power and exposure to the image receptor both increase as the kVp value is raised.

<h3>Exposure to the image receptor is enhanced with an increase in kVp, right?</h3>

Due to an increase in photon quantity and penetrability, exposure at the image receptor rises by a factor of five of the change in kVp, doubling the intensity at the detector with a 15% change in kVp.

To know more about kVp visit:-

brainly.com/question/17095191

#SPJ4

5 0
1 year ago
A skilled worker with the ability to operate computer numerically controlled (CNC) machines is qualified to work in which of the
KengaRu [80]

Answer:

Machinist

Explanation:

A skilled worker with the ability to operate computer numerically controlled (CNC) machines is qualified to work in a machinist position.

A machinist is a person who is properly skilled and consists of advanced knowledge regarding the functions of a CNC machine. He can use different mechanisms and complex numerical functions of the machine to carry out different tasks. Any person who lacks the official learning of mechanisms cannot operate such machines effectively.

3 0
3 years ago
The inner surface of a hollow cylinder is subjected to tangential and axial stresses of 40,000 and 24,000 psi, respectively. Det
Furkat [3]

Answer:

15,000 psi

Explanation:

The solution / solving is attach below.

5 0
3 years ago
Other questions:
  • A water pump delivers 6 hp of shaft power when operating. The pressure differential between the outlet and the inlet of the pump
    9·1 answer
  • Consider a plane composite wall that is composed of two materials of thermal conductivities kA = 0.1 W/m*K and kB = 0.04 W/m*K a
    13·1 answer
  • g A plane stress element has components sigma x = 160 MPa, tau xy = 100 MPa (CW). Determine the two values pf sigma y for which
    13·1 answer
  • Part of the basic procedures is the vehicle check. What does that mean?
    7·1 answer
  • Do heavier cars really use more gasoline? Suppose a car is chosen at random. Let x be the weight of the car (in hundreds of poun
    9·1 answer
  • 2.(10 pts)A proposed engine cycle employs an ideal gas and consists of the following sequence of transformations; a) Isothermal
    12·1 answer
  • 1) Each of the following would be considered company-confidential except
    10·1 answer
  • What would happen if the brake pedal was released while the bleed screw was open during brake bleeding?
    7·1 answer
  • In a stream channel, the total volume of water flowing through a cross-section of stream is _______.
    9·1 answer
  • Can someone help me LA project pls :((
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!