Answer to Question #187471 in C for Rubayet Adbir

Question #187471

Write a function that calculates the speed of sound (a) in air of a given temperature T (Fahrenheit) which is passed as parameter and returns the speed. Be sure your function does not lose the fractional part of the quotient in the formula shown. Formula to compute the speed in ft/sec:

alpha = 1086sqrt((5T+297)/(247)



1
Expert's answer
2021-04-30T04:54:28-0400
#include <iostream>
#include <cmath>


using namespace std;


double CalculateSpeed(double temperature)
{
    double result = 1086 * sqrt((5 * temperature + 297)/247);
    return result;
}


int main()
{
    double t;
    cout << "Enter the value of temperature: ";
    cin >> t;
    cout << "The speed is " << CalculateSpeed(t) << endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS