Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

basic C

Name: Anonymous 2010-11-24 12:17

can you help create a program that will accept an amount and output its denomination.

example

amount: 5670.45

1000: 5
500: 6
200: 0
100: 6
50: 1
20: 1
10: 0
.25: 1
.05: 3

Name: Anonymous 2010-11-24 19:28


($amt, @dens).reduce({
    my $x = 0;
    if $^b <= $^a {
        $x = ($a/$b).floor;
        say "$b:\t$x";
    }
    $a - $b * $x;
});

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List