JAVA求N!

import java.math.BigInteger;
import java.util.Scanner;

public class theFactor_of_N {

    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int t=n;
        BigInteger res=new BigInteger("1");
        for(int i=2;i<=n;i++ ){
            String tp=""+i;
            BigInteger res1=new BigInteger(tp);
            res=res.multiply(res1);

        }
        System.out.println(res);
        in.close();//用了vscode才知道这里要关上QAQ
    }

}

 

全部评论

相关推荐

qq乃乃好喝到咩噗茶:院校后面加上211标签,放大加粗,招呼语也写上211
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
05-01 13:13
ecece:这么明目张胆虚报就业率啊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务