Tue Oct 28, 2008 2:00 pm
<?php
function subtract($n1, $n2) {
return $n1 - $n2;
}
function add($n1, $n2) {
return $n1 + $n2;
}
function divide($n1, $n2) {
if($n2 == 0)
return -1;
else
return $n1 / $n2;
}
function multiply($n1, $n2)
{
return $n1 * $n2;
}
function to_pow($n1, $pow)
{
if($pow)
return $n1 * to_pow($n1, $pow - 1);
return 1;
}
print(to_pow(6, 1) . "<br />");
print(multiply(5, 10) . "<br />");
print(divide(5, 10) . "<br />");
print(subtract(10, 50) . "<br />");
print(add(10, 5) . "<br />");
?>
</body>
</html>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.