A small example of php narcissus number

WBOY
Release: 2016-07-25 09:12:57
Original
1445 people have browsed it

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


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template