php求水仙花数

xiaoxiao2021-03-01  26

php求水仙花数

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <title>无标题文档</title> </head> <body alink="center"> <?php for($i=100;$i<=999;$i++){ $a=floor($i/100);//获取百位 $b=floor($i0/10);//获取十位 $c=$i;//获取各位 if(pow($a, 3)+pow($b, 3)+pow($c , 3)==$i){ echo $i.'<br>'; } } ?> </body> </html>
转载请注明原文地址: https://www.6miu.com/read-3350033.html

最新回复(0)