Question

7. Celsius Temperature Table The formula for converting a temperature from Fahrenheit to Celsius is the Fahrenheit temperatur
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Since it is not mentioned in which language the program needs to be implemented, MATLAB is selected to develop the code.

MATLAB Code

%initializing the vector of Fahrenheit
fh=0:20;
%Display the heading on the command window
fprintf('Fahrenheit\tCelsius\n')
%'for' loop calling 'celsius' function
for m=1:length(fh)
%Calling 'celsius' function
cg=celsius(fh(1,m));
%Display fahrenheit and celsius temperature on command window.
fprintf('%1.2f\t\t%1.2f\n',fh(m),cg)
end
%function definition
function c=celsius(f)
c=5/9*(f-32);
end

Output on the command window

Fahrenheit   Celsius
0.00       -17.78
1.00       -17.22
2.00       -16.67
3.00       -16.11
4.00       -15.56
5.00       -15.00
6.00       -14.44
7.00       -13.89
8.00       -13.33
9.00       -12.78
10.00       -12.22
11.00       -11.67
12.00       -11.11
13.00       -10.56
14.00       -10.00
15.00       -9.44
16.00       -8.89
17.00       -8.33
18.00       -7.78
19.00       -7.22
20.00       -6.67

Add a comment
Know the answer?
Add Answer to:
7. Celsius Temperature Table The formula for converting a temperature from Fahrenheit to Celsius is the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT