You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
<?php
|
|
function add_digits($num)
|
|
{
|
|
if ( $num > 0)
|
|
{
|
|
return ($num - 1) % 9 + 1;
|
|
}
|
|
else
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
print_r(add_digits(48)."\n");
|
|
print_r(add_digits(59)."\n");
|
|
?>
|