How to resolve the algorithm Temperature conversion step by step in the VBScript programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Temperature conversion step by step in the VBScript 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 VBScript programming language
Source code in the vbscript programming language
WScript.StdOut.Write "Enter the temperature in Kelvin:"
tmp = WScript.StdIn.ReadLine
WScript.StdOut.WriteLine "Kelvin: " & tmp
WScript.StdOut.WriteLine "Fahrenheit: " & fahrenheit(CInt(tmp))
WScript.StdOut.WriteLine "Celsius: " & celsius(CInt(tmp))
WScript.StdOut.WriteLine "Rankine: " & rankine(CInt(tmp))
Function fahrenheit(k)
fahrenheit = (k*1.8)-459.67
End Function
Function celsius(k)
celsius = k-273.15
End Function
Function rankine(k)
rankine = (k-273.15)*1.8+491.67
End Function
You may also check:How to resolve the algorithm Fibonacci sequence step by step in the Mirah programming language
You may also check:How to resolve the algorithm Execute HQ9+ step by step in the Ruby programming language
You may also check:How to resolve the algorithm 100 doors step by step in the PascalABC.NET programming language
You may also check:How to resolve the algorithm Bitwise operations step by step in the MAXScript programming language
You may also check:How to resolve the algorithm Verify distribution uniformity/Chi-squared test step by step in the D programming language