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
Darya [45]
3 years ago
9

Using language c, find the nth Fibonacci, knowing that nth Fibonacci is calculated by the following formula: - If n = 1 Or n = 2

then F(n) = 1 - If n>2 then F(n) = F(n-1) + F(n-2)
Computers and Technology
1 answer:
Nina [5.8K]3 years ago
4 0

Answer:

#include <stdio.h>

int fib(int n) {

 if (n <= 0) {

   return 0;

 }

 if (n <= 2) {

   return 1;

 }

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

}

int main(void) {

 for(int nr=0; nr<=20; nr++)

   printf("Fibonacci %d is %d\n", nr, fib(nr) );

 return 0;

}

Explanation:

The code is a literal translation of the definition using a recursive function.

The recursive function is not per se a very efficient one.

You might be interested in
Suppose you are an ad-serving company and you maintain a log of cookie data for ads you serve to the Web pages for a particular
Firlakuza [10]

Answer:

A

Explanation:

thethe more you have attached the more people are going to know your product so that it's going to be a long process which people can introduce to their friends

3 0
3 years ago
How can i change ip address <br>​
JulijaS [17]

I believe your answer would be:

1: Open the command prompt window. Do this by clicking the "Start" button, and then selecting "Run." In the window that appears, type "cmd" into the text box and click the "OK" button.

2: Release the computer's current IP address. To do this, type "ipconfig /release" into the command prompt window and press Enter.

3: Acquire a new IP address. Do this by typing "ipconfig /renew" into the command prompt window and pressing Enter. This should assign the computer a new IP address, which will be different from the previous address.

4: Cycle your modem's power. If the above steps don't work, you can try renewing your IP address by cycling your modem's power. Turn off both your computer and your modem (and your router, if you have one). Wait at least 5 minutes, then turn everything back on. If your computer is set to receive an IP address dynamically (the most likely configuration), you should be assigned a new IP address automatically.

5: Check to make sure your IP address has changed. To do this, you can log on to a number of different websites that tell you your IP address.

Hope I helped, if so may I get brainliest and a thanks?

Thank you, Have a good day! =)

7 0
3 years ago
What is the configuration of a multimedia computer​
sertanlavr [38]

Answer:

) In computers and computer networks, a configuration often refers to the specific hardware and software details in terms of devices attached, capacity or capability, and exactly what the system is made up of.

Explanation:

hope it helps

3 0
3 years ago
How many Little mermaid movies are there? I know there is little mermaid 1 and 2, but I am not sure how many total movies there
kupik [55]
There have only been 3 Little Mermaid movies. 

<span>1. The Little Mermaid (1989) </span>
<span>2. The Little Mermaid 2 Return to the Sea (2000) </span>
<span>3. The Little Mermaid 3 Ariel's Beginning (2008)

hope this helps you(:

if not plz let me know (:

have a good day 
-denis</span>
7 0
3 years ago
Read 2 more answers
Which of the following correctly orders the investments from LOWER risk to HIGHER risk?
erma4kov [3.2K]

Treasury bond − Diversified mutual fund - Stocks.

An investment is an asset or item that is purchased with the hope that it will generate income or will appreciate in value. All investments involve some degree of risk. In finance, risk refers to the degree of uncertainty or potential financial loss that could happen in an investment decision.

In general, as investment risks rise, investors seek higher returns to compensate themselves for taking such risks. Relying on personal resources has more risk than relying on public resources of producers.

Usually, a portfolio made up of 60% stocks, 30% mutual funds, and 10% Treasury bonds would be considered to be the highest risk portfolio.

3 0
3 years ago
Other questions:
  • Which of the following might an early 20th -century film producer do in order to draw an audience?
    13·1 answer
  • How many parameters go into the function sum, and how many return values come out of the function sum? function sum(first, secon
    6·1 answer
  • What component of effective feedback is demonstrated by giving examples of what an employee is doing right instead of just prais
    14·2 answers
  • Write a class named Episode. An instance of this episode class will represent a single episode of a TV show, with a title, a sea
    12·1 answer
  • Consider the formula: G=D+(A+C^2)*E/(D+B)^3 Show the order that a processor would follow to calculate G. To do so, break down th
    10·1 answer
  • What subsection of the Internet requires specialized browser to access and is frequently used by cyber criminals and underground
    10·1 answer
  • The insert options button lists formatting options. true or false.
    11·1 answer
  • Write an if-else statement for the following: If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets
    6·1 answer
  • What is the difference between MySQL and MariaDB?
    9·1 answer
  • Energy/power management systems, kitchen appliances, smart televisions, baby monitors, fitness trackers, and personal health mon
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!