Skip to content

Instantly share code, notes, and snippets.

@earino
Created May 3, 2013 18:09
Show Gist options
  • Save earino/5512187 to your computer and use it in GitHub Desktop.
Save earino/5512187 to your computer and use it in GitHub Desktop.
column figure outer for sandy
#!/usr/bin/env perl
#
use warnings;
use strict;
{
print "How many items: ";
my $items = <STDIN>;
print "How many columns: ";
my $columns = <STDIN>;
chomp ($items);
chomp ($columns);
my $base = int($items / $columns);
my $leftover = $items % $columns;
for my $i ( 1 .. $columns) {
my $column_count = $base + ($leftover > 0 ? 1 : 0);
$leftover--;
print "Column $i has: $column_count items.\n";
}
redo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment