package 课本习题;
public class Test_2_10_阶乘 {
public static void main(String[] args) {
int sum=0;
for(int i=1;i<=10;i++) {
int n=1;
for(int j=1;j<=i;j++) {
n=n*j;
}
if(i<10)
System.out.print(n+"+");
else
System.out.print(n);
sum=sum+n;
}
System.out.println("="+sum);
}
}
转载请注明原文地址:https://blackberry.8miu.com/read-33898.html