2012-10-18 03:57:27 +00:00
|
|
|
/*
|
|
|
|
Compute heights in centimeters for a range of heights
|
|
|
|
expressed in feet and inches
|
|
|
|
*/
|
|
|
|
import std.stdio;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
// Values unlikely to change soon
|
|
|
|
immutable inchesPerFoot = 12;
|
|
|
|
immutable cmPerInch = 2.54;
|
|
|
|
|
|
|
|
// Loop'n write
|
|
|
|
foreach (feet; 5 .. 7) {
|
|
|
|
foreach (inches; 0 .. inchesPerFoot) {
|
2012-10-18 04:00:36 +00:00
|
|
|
writefln("%s'%s''\t%s", feet, inches,
|
2012-10-18 03:57:27 +00:00
|
|
|
(feet * inchesPerFoot + inches) * cmPerInch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|