Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (5 pts) Write a script that will prompt the user for a temperature in degrees

ID: 3349260 • Letter: 1

Question

1. (5 pts) Write a script that will prompt the user for a temperature in degrees Cesin thscale specified by t and then an F for Fahrenheit or K for Kelvin. The script will print the correspondi user. For example, the output might look like this: ing temperature in the scale specified by the Enter the temp in degrees C: 27.3 Do you want F or K? K The temp in degrees F is 300.4 K. The The format of the output should be exactly as specified here. Assume the user enters only F or conversions are: F- 32 K C+273.15

Explanation / Answer

prompt = 'Enter the temperature in degree C: ';
C = input(prompt);
F = ((9/5)*C)+32;
K = C+273.15;
prompt = 'Do you want F or K: ';
str = input(prompt,'s');
if str=='K'
disp(K);
elseif str=='F'
disp(F);   
end