version 1.5, 2012/02/10 00:13:35
|
version 1.7, 2015/06/03 10:25:12
|
Line 3
|
Line 3
|
<script type="loncapa/perl"> |
<script type="loncapa/perl"> |
sub fact { |
sub fact { |
my $n=shift; |
my $n=shift; |
if ($n==1) { |
if ($n<=1) { |
return $n; |
return 1; |
} else { |
} else { |
return $n*&fact($n-1); |
return $n*&fact($n-1); |
} |
} |
Line 43 boolean function <tt>&negative(numbe
|
Line 43 boolean function <tt>&negative(numbe
|
Sample code for an evaluation script can be found <a href="/res/adm/includes/templates/sampleexternal.pl">here.</a></instructorcomment> |
Sample code for an evaluation script can be found <a href="/res/adm/includes/templates/sampleexternal.pl">here.</a></instructorcomment> |
<endouttext /> |
<endouttext /> |
<externalresponse url="$externalurl" answer="$testvalues" form="%args" answerdisplay="The most elegant (and dangerous) solution is recursive."> |
<externalresponse url="$externalurl" answer="$testvalues" form="%args" answerdisplay="The most elegant (and dangerous) solution is recursive."> |
<textfield /> |
<textfield></textfield> |
|
|
</externalresponse> |
</externalresponse> |
</problem> |
</problem> |