Security Override - Programming 6&7




Trinomial Factoring

say $text;
my @all_nums    = $text =~ /(\d+)/g;
say $all_nums[1];
say $all_nums[2];

my $b = $all_nums[1];
my $c = $all_nums[2];

say $b**2;
say 4*$c;

my $x1 = (-$b + sqrt($b**2 - 4*$c))/2;
my $x2 = (-$b - sqrt($b**2 - 4*$c))/2;

say $x1;
say $x2;

$x1 = $x1*-1;
$x2 = $x2*-1;

my $result = "(x+".$x1.")(x+".$x2.")";

say $result;

Prime Factorization

say $text;

my $x = $text;
my @p;
my $totale=0;

for ( my $y = 2; $y <= $x; $y++ ) {
    next if $x % $y;
    $x /= $y;
    print $y, "\n";
    push @p,$y;
    $totale += $y;

    redo;
}

#say @p;
say $totale;
my $result=$totale;




Categories: , Share

Leave a Reply