js的作業題

來源:互聯網
上載者:User

標籤:code   div   bre   for   script   i++   nbsp   javascrip   條件   

<script type="text/javascript">//var a=3;//switch(a)// {//    case 1://    alert("1");//    break;//    case 2://    alert("2");//    break;//    case 3://    alert("3");//    break;//    case 4://    alert("4");//    break;//    }//defaule:(預設的意義)    //alert:(輸出的數字不滿足條件)//1、一張紙的厚度是0.0001;對摺多少次到達珠穆朗瑪峰的高度8848//var hou=0.0001;//for(var i=0;i>=0;i++)//{hou=hou*2;// if(hou>8848)// {cishu=i;// break;}}// alert(cishu);   // 2.有一對幼兔,幼兔1個月後長成小兔,小兔1個月後長成成兔並生下一對幼兔,問8個月後有多少對兔子,幼兔、小兔、成兔對數分別是多少。   var prevyou = 1;   var prevxiao = 0;   var prevcheng = 0;      var nowyou = 0;   var nowxiao = 0;   var nowcheng =0;      for(var i=0;i<8;i++)   {           當前月份幼兔 = 上個月的成兔+上月小兔      nowyou = prevcheng+prevxiao;      當前月份小兔 = 上月幼兔      nowxiao = prevyou;      當前月份成兔 = 上月成兔+上月小兔      nowcheng = prevcheng+prevxiao;          當前月數量轉換為上個月的數量      prevyou = nowyou;      prevxiao = nowxiao;      prevcheng = nowcheng;   }   alert(nowyou);   alert(nowxiao);   alert(nowcheng);     // 3.羽毛球拍15元,球3元,水2元。200元每種至少一個,有多少可能//   var sl=0;//   //   for(var i=1;i<14;i++)//   {//       for(var j=1;j<67;j++)//       {//           for(var s=1;s<101;s++)//          {//              if(i*15+j*3+s*2==200) //              {//                  //alert(i+"--"+j+"--"+s);//                  sl++; //                  //              }//           }   //        }//    }//    alert(sl);//    //   4.公雞2文,母雞1文,小雞半文,每種至少一隻,100文買100隻雞有多少可能性//   var sl=0;//   for( var i=1;i<51;i++)//   {//       for(var j=1;j<101;j++)//       {//           for(var k=1;k<201;k++)//           {//               if(i*2+j*1+k*0.5==100 &&  i+j+k==100)//               {//                   sl++;//                }//            }//        }////    }//   alert(sl);//   //   5.湊錢1,2,5湊20元錢有多少可能//   var sl=0;//   for(var i=0;i<21;i++)//   {//       for(var j=0;j<11;j++)//       {//           for(var k=0;k<5;k++)//           {//               if(i*1+j*2+k*5==20)  //               {//                   sl++;   //                } //            }   //        }//    }//    alert(sl);//    // /6、 括弧裡面只能放加或減,如果要使等式成立,括弧裡面應該放什麼運算 12()34()56()78()9 = 59//    for(var i=-1;i<2;i=i+2)//    {//        for(var j=-1;j<2;j=j+2)//        {//            for(var k=-1;k<2;k=k+2)//            {//                for(var l=-1;l<2;l=l+2)//                {//                    if(12+i*34+j*56+k*78+l*9==59)//                    {//                        alert(i+"|"+j+"|"+k+"|"+l);//                    }//                }//            }//        }//    }</script>

 

js的作業題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.