Square root by hand: Difference between revisions
m
→{{header|Raku}}: not handling zero & stop unnecessary increments
(added Raku programming solution) |
m (→{{header|Raku}}: not handling zero & stop unnecessary increments) |
||
Line 545:
my $d = 9; # unit digit part of divisors & running answer
my $D = ''; # tens+ digit part of divisors
my $dot_printed = False;
my $dividend; my $quotient = ''; my $remainder;
return "Sorry, minimum charge is $0⁺" if $in
if $in.narrow ~~ Int { # integer
Line 569:
unless @dividends.Bool {
last if ( $remainder == 0 and $quotient != 0 and !@fractional.Bool );
unless $dot_printed { print '.'
if @fractional.Bool { # happen only once
@dividends.append: @fractional;
|