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
Andrew [12]
3 years ago
13

The Fibonacci numbers are a sequence of integers in which the first two elements are 1, and each following element is the sum of

the two preceding elements. The first 12 Fibonacci numbers are: 1 1 2 3 5 8 13 21 34 55 89 144 Write a piece of code that uses a for loop to compute and print the first 12 Fibonacci numbers. (You may include other code, such as declaring variables before the loop, if you like.)
Computers and Technology
1 answer:
ioda3 years ago
4 0

Answer:

// program in java to print 12 fibonacci terms

// package

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

     

      // variables

      int no_of_term=12, f_term = 1, s_term = 1, n_term = 0;

      System.out.print("First 12 term of Fibonacci Series:");

      // print 12 terms of the Series

       for (int x = 1; x<= no_of_term; x++)

           {

       // Prints the first two terms.

            if(x <=2 )

            System.out.print(1+" ");

            else

            {

               // find the next term

                n_term = f_term + s_term;

                // update the last two terms

                f_term = s_term;

                s_term = n_term;

                // print the next term

              System.out.print(n_term+" ");

            }

           }

     

     

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare and initialize no_of_term=12,f_term=1,s_term=1 and n_term=0.Run a loop  for 12 times, for first term print 1 and then next term will be calculated as  sum of previous two term of Series.Then update previous two term.This will  continue for 12 time and print the terms of Fibonacci Series.

Output:

First 12 term of Fibonacci Series:1 1 2 3 5 8 13 21 34 55 89 144

You might be interested in
Assume that two students are trying to register for a course in which there is only one open seat. What component of a database
lisabon 2012 [21]

The component of the database that prevents both students from getting the last seat is: transaction isolation

Data that enters the database are expected to maintain accuracy and also be consistent with the database structure.

So, when both students request for the last seat, the possibilities are:

  • <em>Student A gets the seat</em>
  • <em>Student B gets the seat</em>

The following is not a possibility

  • <em>Both students get the seat</em>
  • <em>None of the students gets the seat</em>

The above highlights means that, only one of the students would get the seat.

This is possible because of the concept called transaction isolation.

The transaction isolation ensures that the data requested by a user is <em>complete </em>and such data maintains <em>competency</em>.

So, when a student gets the last seat, the <em>next student </em>would not get the same seat (<em>or any other seat</em>), because a transaction has already been completed.

Read more about transaction isolation at:

brainly.com/question/13030145

8 0
3 years ago
Read 2 more answers
In Python, when do we use the str( ) function
pav-90 [236]

Answer:

Both str () and repr () methods in python are used for string representation of a string.

Explanation:

Though they both seem to serve the same purpose, there is a little difference between them. Have you ever noticed what happens when you call a python built-in function str (x) where x is any object you want?

7 0
2 years ago
________ is used to install and update software, backup, and restore mobile devices, wipe employer software and data from device
erastovalidia [21]

Answer: MDM softwares

Explanation:

Here MDM refers to mobile device management software which provides people with the facilities of updating, installing creating backup of various mobile devices within an organisation. Moreover these software's provides tools for proper monitoring and to report their usage across various independent mobile device users. MDM is often used or interconnected with the term BYOD(Bring your own device), whereby employees of an organisation bring their own mobile devices and they are being managed by a MDM software centrally.

8 0
4 years ago
Which mechanism will move a port into a root-inconsistent state if bpdus coming from a certain direction indicate another switch
erma4kov [3.2K]

A root guard is seen as the  mechanism will move a port into a root-inconsistent state if bpdus coming from a certain direction indicate another switch is trying to become the root bridge.

<h3>What is Root guard?</h3>

Root guard is known to be a term that pertains to the family of STP feature and it is one that is enabled only on a port-by-port basis.

Note that  it hinders a configured port from changing to a root port and as such, a root guard is seen as the  mechanism will move a port into a root-inconsistent state if bpdus coming from a certain direction indicate another switch is trying to become the root bridge.

Learn more about root guard from

brainly.com/question/27780486

#SPJ1

4 0
2 years ago
In an input file, what maintains the location of the next item that will be read from the file?
Semmy [17]

The Read Position marks the location of the next item that will be read from the file.

6 0
4 years ago
Other questions:
  • To share a document in my online electronic journal, I should select the option to _____.
    14·1 answer
  • Eric has asked you to help him build a new gaming computer so that he can play the newest games available. He also wants the com
    6·1 answer
  • What are some examples of how AutoFormat can convert text as you type? Check all that apply.
    8·1 answer
  • Which of these is not an application software?
    6·2 answers
  • Decribe the advantages of using emails compared with physical faxing ?
    8·1 answer
  • Write a method that takes a Rectangle as a parameter, and changes the width so it becomes a square (i.e. the width is set to the
    8·1 answer
  • Trebuie sa scrii niște instrucțiuni în JavaScript care adaugă în DIV lungimea HTML-ului din interiorul tag-ului cu ID​
    14·1 answer
  • What type is the combination of an integer and a string
    13·1 answer
  • Tristan just downloaded a new game he wants to play on his computer. What kind of file should he open in order to install and ru
    5·1 answer
  • an engineer is writing a web application that requires some user input. the engineer has put a submit button on their page and n
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!