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

# 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)

BEGIN {
    printf "%.1f\n", 32 / (1 - 9/5);
    exit 0;
}