Question: program C Part 1 (50 points) Write a function that is able to calculate the resistance of a metal given the resistivity of a particular

program C

Part 1 (50 points)

Write a function that is able to calculate the resistance of a metal given the resistivity of a particular metal (expressed as a double), the length of the wire in meters (expressed as an int), and the diameter of the wire in millimeters (expressed also as an int).

  1. Be sure to write at least one multi-line comment above the function describing what it does, how to use it, etc..
  2. In addition, within the function, include comments explaining what the pieces of your code are doing.

The formula for calculating the resistance of a metal is as follows:

Resistance = resistivity * length of wire / area of wire

Here is the prototype for the function that you must follow. In vocareum, the prototype is already written into hw2.h and MUST be included in your file. Your c file should also be named hw2.c.

Part 2 (50 points each correctly calculated term up to 46 will result in 1/46th % credit of the 50 pts)

Write a function that can calculate the nth term in the Fibonacci sequence given some whole number n. You should use Binets formula in your function to solve this. You DO NOT need to worry about negative numbers for n.

Your function ONLY needs to be correct up to the 46th fib term.

Below is the prototype for the function you will be making. It will be included in hw2.h.

int calc_fibn(int n);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!