精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • 用C#for循環(huán)寫下,最好是簡單點,或?qū)懮献⑨?/h1>

    用C#for循環(huán)寫下,最好是簡單點,或?qū)懮献⑨?br/>12.輸出四位自然數(shù)中各位數(shù)字之和為6并且各位數(shù)字互不相同的數(shù),并統(tǒng)計個數(shù).
    13.由數(shù)字1、2、3、4、5、6六個數(shù)字共可組成多少個沒有重復(fù)數(shù)字的四位數(shù),輸出這些數(shù)據(jù)并統(tǒng)計個數(shù).
    15.打印“*”字三角形:從鍵盤輸入一個自然數(shù)N(1《N《 9).根據(jù)N的值,打印輸出對應(yīng)的“*”字三角形.如N=4,輸出
            ?。?br/>       ?。?br/>       *****
         ?。?/div>
    數(shù)學(xué)人氣:519 ℃時間:2020-06-17 15:29:09
    優(yōu)質(zhì)解答
      這是第15題的打印,這個比較常見,在控制臺中將下面代碼復(fù)制到Main函數(shù)中:/*根據(jù)輸入的行數(shù)打印出星號組成的三角形*/            Console.WriteLin...還好給了網(wǎng)站,上面的答案都沒有

      這是14題的代碼,和15題一樣,在控制臺中運(yùn)行(排版比較亂,放到編譯器中自動重新排版下吧,沒辦法,回復(fù)答案有字?jǐn)?shù)限制):

    int count = 0;/*循環(huán)千位*/
    for (int thousand = 1; thousand <= 6; thousand++){/*循環(huán)百位*/
    for (int hundred = 1; hundred <= 6; hundred++){/*循環(huán)十位*/
    for (int ten = 1; ten <= 6; ten++){/*循環(huán)個位*/
    for (int single = 1; single <= 6; single++){
    /*判斷千位數(shù)是否和百位數(shù)、十位數(shù)、個位數(shù)相等。*/
    bool isThousandEq = thousand != hundred && thousand != ten && thousand != single;
    /*判斷百位數(shù)是否和十位數(shù)、個位數(shù)相等*/
    bool isHundredEq = hundred != ten && hundred != single;
    /*判斷十位數(shù)是否和個位數(shù)相等*/bool isTenEq = ten != single;
    if (isThousandEq && isHundredEq && isTenEq){/*計算最終結(jié)果*/
    int result = thousand * 1000 + hundred * 100 + ten * 10 + single;
    Console.Write(result);Console.Write(",");count++;}}}}}
    Console.WriteLine("\n----------------------------------------------------------------");
    Console.WriteLine("不重復(fù)的個數(shù):{0}",count);
    Console.Read();
    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點,以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版