Exercise 6: Complete the following code (switch-case statement) Write a script to convert the temperature from Fahrenhei
Posted: Mon May 02, 2022 11:47 am
Complete the MATLAB code by filling the blanks
Exercise 6: Complete the following code (switch-case statement) Write a script to convert the temperature from Fahrenheit to Celsius and vice versa clear cls; temp = input("input a temperature: "); unit = input("Do you want to convert to F or C: ", 's'); switch case {'f', 'F} (9/5) * temp + 32; fprintf("the temperature in F is %f \n", res) BEBER res = case res = 5/9 * (temp-32 fprintf HERE disp("wrong input") end
Exercise 6: Complete the following code (switch-case statement) Write a script to convert the temperature from Fahrenheit to Celsius and vice versa clear cls; temp = input("input a temperature: "); unit = input("Do you want to convert to F or C: ", 's'); switch case {'f', 'F} (9/5) * temp + 32; fprintf("the temperature in F is %f \n", res) BEBER res = case res = 5/9 * (temp-32 fprintf HERE disp("wrong input") end