Solver Divisibility of one number over another
Algebra
->
Algebra
->
Divisibility and Prime Numbers
-> Solver Divisibility of one number over another
Log On
Ad:
Algebra Solved!™
: algebra software solves algebra homework problems with step-by-step help!
Ad:
Algebrator™
solves your algebra problems and provides step-by-step explanations!
Algebra: Divisibility and Prime Numbers
Solvers
Lessons
Problems, free tutors
Quiz
In Depth
Source code of 'Divisibility of one number over another'
This Solver (Divisibility of one number over another)
was created by by
ichudov(404)
:
View Source
,
Show
,
Put on YOUR site
About ichudov
:
I am not a paid tutor, I am the owner of this web site.
==section input Is *[input a=18] divisible by *[input b=6]? ==section solution perl unless( $a =~ /^\d+$/ ) { print "Natural number expected instead of '$a'.\n"; return; } unless( $b =~ /^\d+$/ || $b == 0 ) { print "Natural number expected instead of '$b'.\n"; return; } print "To solve this problem, try dividing $a by $b. If your result is a whole number, then $a is divisible by $b. <BR>"; if( ($a % $b) == 0 ) { print "<B>Answer: Yes, $a is divisible by b</B>. $a = " . int($a/$b) . " * $b"; $divisible = 1; } else { my $frac = int( $a/$b) . chr(38) . reduce_fraction( ($a % $b), $b ); print "<B>Answer: No, $a is not divisible by $b</B>: {{{$a = $frac* $b}}}, and {{{$frac}}} is not an integer number.\n"; $divisible = 0; } ==section output divisible ==section check a=6 b=2 divisible=1 a=15 b=6 divisible=0