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

  • <center id="usuqs"></center>
  • 
    
  • java 數(shù) n的階乘, 階乘, 公式 為 n!=n*(n-1)(n-2)…*2 * 1 .求 數(shù)字 6的階乘 的階乘 .

    java 數(shù) n的階乘, 階乘, 公式 為 n!=n*(n-1)(n-2)…*2 * 1 .求 數(shù)字 6的階乘 的階乘 .
    java編程
    其他人氣:117 ℃時間:2019-12-13 18:04:29
    優(yōu)質(zhì)解答
    import java.math.BigInteger;
     
    public class Test {
     
        public static void main(String[] args) {
            int n = 6;
            System.out.println(jiecheng(n));
        }
        
        public static BigInteger jiecheng (int i) {
             BigInteger result = new BigInteger("1");
            for (int j = 1; j <= i; j ++) {
                   BigInteger num = new BigInteger(String.valueOf(j));
                   result = result.multiply(num);
            }
            return result;
        }是錯的
     public class Test {
     
        public static void main(String[] args) {
            int n = 6;
            System.out.println(jiecheng(n));
        }
        
        public static Double jiecheng (int i) {
            Double result = 1.0;
            for (int j = 1; j <= i; j ++) {
            \x09result *= j;
            }
            return result;
        }
    }

     

    第一次回答那個代碼只是少了一個“{”號而已,我復(fù)制過去的時候不小心。

    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點(diǎn),以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版