How to resolve the algorithm Temperature conversion step by step in the XLISP programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Temperature conversion step by step in the XLISP programming language
Table of Contents
Problem Statement
There are quite a number of temperature scales. For this task we will concentrate on four of the perhaps best-known ones: Kelvin, Celsius, Fahrenheit, and Rankine. The Celsius and Kelvin scales have the same magnitude, but different null points. The Fahrenheit and Rankine scales also have the same magnitude, but different null points. The Celsius/Kelvin and Fahrenheit/Rankine scales have a ratio of 5 : 9.
Write code that accepts a value of kelvin, converts it to values of the three other scales, and prints the result.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Temperature conversion step by step in the XLISP programming language
Source code in the xlisp programming language
(DEFUN CONVERT-TEMPERATURE ()
(SETQ *FLONUM-FORMAT* "%.2f")
(DISPLAY "Enter a temperature in Kelvin.")
(NEWLINE)
(DISPLAY "> ")
(DEFINE K (READ))
(DISPLAY `(K = ,K))
(NEWLINE)
(DISPLAY `(C = ,(- K 273.15)))
(NEWLINE)
(DISPLAY `(F = ,(- (* K 1.8) 459.67)))
(NEWLINE)
(DISPLAY `(R = ,(* K 1.8))))
You may also check:How to resolve the algorithm Square but not cube step by step in the C programming language
You may also check:How to resolve the algorithm Variadic function step by step in the Swift programming language
You may also check:How to resolve the algorithm Zig-zag matrix step by step in the PureBasic programming language
You may also check:How to resolve the algorithm String concatenation step by step in the Stata programming language
You may also check:How to resolve the algorithm Binary search step by step in the Vedit macro language programming language