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).
- Be sure to write at least one multi-line comment above the function describing what it does, how to use it, etc..
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started