Home >Backend Development >PHP Tutorial >4 examples of how to implement the number of daffodils in PHP_PHP tutorial
Example 1:
";
Example 2:
The code is as follows:
The code is as follows:
function winter($num)
{
if($num<1000){
//Define the ones place
$ge=$num%10;
//Define ten Digits
$ten=(($num%100)-$ge) /10;
//Define hundreds place
/*floor rounding, ignoring all numbers after the decimal point*/
$ hundred=floor($num/100);
$sum1=$ge*$ge*$ge+$ten*$ten*$ten+$hundred*$hundred*$hundred;
if($sum1== $ Num) {
} Else {
Return 0;
}
return -1;
if(winter(371)==-1) {
echo "A number greater than 1000";
if(winter(371)) {
;
?>
http://www.bkjia.com/PHPjc/750859.html
www.bkjia.com
true
TechArticle