public class TestFor{
public static void main(String[] args){
long result = 0;
long flag = 1;
for(int i = 1; i <= 10; i++){
flag =flag * i;
result += flag;
}
System.out.println("10!=" + result);
}
}
计算result=1! + 2! + ... + 10!
最新推荐文章于 2023-01-02 12:13:25 发布