How to resolve the algorithm Temperature conversion step by step in the PicoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Temperature conversion step by step in the PicoLisp 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 PicoLisp programming language

Source code in the picolisp programming language

(scl 2)

(de convertKelvin (Kelvin)
   (for X
      (quote
         (K . prog)
         (C (K) (- K 273.15))
         (F (K) (- (*/ K 1.8 1.0) 459.67))
         (R (K) (*/ K 1.8 1.0)) )
      (tab (-3 8)
         (car X)
         (format ((cdr X) Kelvin) *Scl) ) ) )

(convertKelvin 21.0)

  

You may also check:How to resolve the algorithm Count in octal step by step in the Standard ML programming language
You may also check:How to resolve the algorithm Dragon curve step by step in the PowerShell programming language
You may also check:How to resolve the algorithm Law of cosines - triples step by step in the 11l programming language
You may also check:How to resolve the algorithm Averages/Mean angle step by step in the Wren programming language
You may also check:How to resolve the algorithm Universal Turing machine step by step in the Nim programming language