"2016.12.07" javascript exercises

Source: Internet
Author: User

There are three kinds of red, white, black ball several, including red, white ball a total of 25, white, black ball a total of 31, red, black ball a total of 28, beg this three kinds of ball each how many?

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Document</title>    <styletype= "Text/css">Table{Border-collapse:collapse;        }    </style>    <Scripttype= "Text/javascript">document.write ("question 12th"); document.write ("<br/>"); varx, Y, Z  for(x=1; x<= -; x++){             for(y=1; y<= -; y++){                 for(z=1; z<= -; z++){                    if(x+y== -&&y+Z== to&&x+Z== -) {document.write ("x"+x+"y"+y+"Z"+z);  Break; }                }            }        }        //a different approach         for(x=1; x< *; x++) {y= --x; Z= --x; if(y+Z== to) document.write ("<br/>x"+x+"y"+y+"Z"+z); } document.write (""); </Script></Head><Body></Body></HTML>

The second solution is much more efficient than the first, as long as the cycle is more than 10 more than one can produce results, the first to thousands of

"2016.12.07" javascript exercises

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.