Answer to Question #258937 in Databases | SQL | Oracle | MS Access for Tarurendra Kushwah

Question #258937

Write a PL/SQL program to convert a temperature in scale Fahrenheit to Celsius and vice versa.


1
Expert's answer
2021-11-02T17:36:34-0400

PL/SQL Code:

 DECLARE temp1 NUMBER := &input_a_temp; t_scale CHAR := '&input_temp_scale'; new_temp NUMBER; new_scale CHAR; BEGIN IF t_scale != 'C' AND t_scale != 'F' THEN dbms_output.Put_line ('The scale you input is not a valid scale'); new_temp := 0; new_scale := 'C'; ELSE IF t_scale = 'C' THEN new_temp := ( ( 9 * temp1 ) / 5 ) + 32; new_scale := 'F'; ELSE new_temp := ( ( temp1 - 32 ) * 5 ) / 9; new_scale := 'C'; END IF; END IF; dbms_output.Put_line ('The new temperature in scale ' ||new_scale ||' is: ' ||new_temp); END; /

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