![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
水仙花数
才浅学shu
这个作者很懒,什么都没留下…
展开
-
PHP所有水仙花数
以下是100-1000之间的所有水仙花数<? function is_sxh($n){ $a=floor ($n/100); $b=floor (($n%100)/10); $c=floor ($n%10); if($n==(($a*$a*$a)+($b*$b*$b)+($c*$c*$c))){ return true; }else{ return false; } } for($n = 100;$n<=999;$n++){ $result = is_sxh原创 2020-08-24 19:57:51 · 1556 阅读 · 0 评论 -
PHP计算水仙花数
小练习参考代码<? function is_sxh($n){ $a=floor ($n/100); $b=floor (($n%100)/10); $c=floor ($n%10); if($n==(($a*$a*$a)+($b*$b*$b)+($c*$c*$c))){ return true; }else{ return false; } } $result = is_sxh(666); echo var_dump($result);?>要注原创 2020-08-24 19:56:42 · 706 阅读 · 0 评论