Java1-100的阶乘和的代码
时间: 2023-02-18 13:13:50 浏览: 124
java 求1到100的阶乘!
5星 · 资源好评率100%
是什么?
答案是:public class Factorial {
public static void main(String[] args) {
int i,fact=1;
int number=100;//It is the number to calculate factorial
for(i=1;i<=number;i++){
fact=fact*i;
}
System.out.println("Factorial of "+number+" is: "+fact);
}
}
阅读全文