aboutsummaryrefslogtreecommitdiff
path: root/challenge-011/paulo-custodio/lua/ch-1.lua
blob: 64a843766267b3388038860d9df387dc32943cd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env lua

--[[
Challenge 011

Challenge #1
Write a script that computes the equal point in the Fahrenheit and Celsius
scales, knowing that the freezing point of water is 32oF and 0oC, and that
the boiling point of water is 212oF and 100oC. This challenge was proposed
by Laurent Rosenfeld.

F = (C * 9/5) + 32
F = C = x
=>  x = (x * 9/5) + 32
<=> x * (1 - 9/5) = 32
<=> x = 32 / (1 - 9/5)
--]]

io.write(string.format("%.1f", 32 / (1 - 9/5)), "\n")