Write a function convertF(F) that accepts temperature in degrees F and computers
ID: 3816132 • Letter: W
Question
Write a function convertF(F) that accepts temperature in degrees F and computers the corresponding value in degrees C. The relationship between the two is given as: T_c = 5/9(T_F - 32) Be sure to add appropriate comments (i.e. what the function does, what are the inputs, outputs and local variables) for use with help, and test your function. Submit only your function m-file for this problem. Write a function DistVelocity(y_0 a, t) that calculates the distance and velocity of a car undergoing constant acceleration at a time t. The equations; v = v_0 + a t x = v_0t +_1/2 a t^2 where v_0 is initial velocity, v is final velocity, s is distance travelled a is the rate of constant acceleration, and t is time (in seconds). The function should contain enough comments (i.e. what the function does, what are the inputs, outputs and local variables) to be adequately explained in the help file. The function should output both velocity and distance (v and s). Submit only your function m-file for this problem. Make function called loopTest(N) that loops through the values 1 through N and for each number n it should display n' is divisible by 2', 'n is divisible by 3', 'n is divisible by 5' or n is not divisible by 2, 3 or 5'. Use a for loop, the function mod() or rem() to figure out if a number is divisible by 2, 3 or 5.. You can use any combination of if, else, and elseif. The function should contain enough comments (i.e. what the function does, what are the inputs, outputs and local variables) to be adequately explained in the help file. Submit only your function m-file for this problem.Explanation / Answer
in c++
//the following function converts temperature in degree F to degre C
//the calculation may result in decimal value so the return type of function is kept float datatype
/*and also the value that will be passed to the function is given a float datatype and named F will be used as it is in operations*/
float convertF(float F)
{
float c; // c is declared here to be used to store results
//calculating the degree C for corresponding degree F
c=5*(f-32)/9;
//and this is returned to the place where it was called we return the result calculated above using return
return c;
}
/*we can call this function from anywhere using c=convertF(f) where c will store the returned value f is the passed temperature*/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.