July 24, 2016 JavaScript Learning code review

Source: Internet
Author: User

<!doctype html>

<meat charset= "Utf-8" >

<title>javascript Cycle </title>

<body>

<script type= "Text/javascript" >

/*1~100 between Odd and */

var sum=0;

for (Var i=1;1<=100;i++) {if (i%2==1) {sum+=1;}}

document.write (' 1~100 ' between the odd and: ' +sum+ '

      

/* 99 Multiplication Table */

document.write ('

document.write (' <table border= ' 1 ' cellsapcing= ' 0 ' cellpadding= ' 0 ' bgcolor= ' #dddddd ' > ')

for (Var i=1;i<=9;i++) {

document.write (' <tr> ');

for (Var j=1;j<=i;j++) {document.write (' <td> ' +i+ ' x ' +j+ ' = ' + (i*j) ' </td> ');}

document.write (' </tr> ');}

document.write (' </table> ')

document.write (

/* hundred chicken buy hundred money three for*/

for (Var i=0;i<=20;i++) {

for (Var j=0;j<=33;j++) {

for (Var z=0;z<=100;z++) {

if (x+y+z=100&&5*x+3*y+z/3=100) {

document.write (' Rooster: ' +i+ ' only ' + ' hen: ' +j+ ' only ' + ' chick: ' +z+ ' only ');}

}}}

      

/* hundred chicken buy hundred money two for*/

for (Var i=0;i<=20;i++) {

for (Var j=0;j<=33;j++) {

Z=100-i-j;

if (z%3=0&&5*x+3*y+z/3=100) {

document.write (' Rooster: ' +i+ ' only ' + ' hen: ' +j+ ' only ' + ' chick: ' +z+ ' only ');}

}}

</script>

</body>

July 24, 2016 JavaScript Learning code review

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.