Home  >  Article  >  Backend Development  >  A small example of php narcissus number

A small example of php narcissus number

WBOY
WBOYOriginal
2016-07-25 09:12:571446browse

Example, php prints the number of daffodils.

  1. for($q=1;$q<=9;$q++){
  2. for($w=0;$w<=9;$w++){
  3. for($ e=0;$e<=9;$e++){
  4. if($q*$q*$q + $w*$w*$w + $e*$e*$e ==
  5. 100*$q + 10*$w + $e){
  6. echo "$q $w $e "."

    ";

  7. }
  8. }
  9. }
  10. }
  11. ?>
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn