Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/perl -w
use strict;
my $length_proportion = 5;
my $width_proportion = 2;
my $height_proportion = 1;
for my $volume ( ( 500, 120, 100, 85, 75, 60, 50, 40, 25, 10 ) ) {
my $n = ( $volume / $length_proportion / $width_proportion / $height_proportion ) ** (1/3);
my $l = $n * $length_proportion;
my $w = $n * $width_proportion;
my $h = $n * $height_proportion;
printf( "%d: %.2f %.2f %.2f\n", $volume, $l, $w, $h );
}
# END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.