public class T0302{
public static void main(String args[]){
int a = 5;
int temp = array(a);
System.out.println(temp);
}
public static int array(int n){
int sum = 0;
for(int i = 1; i <= n ;i ++){
int b = 1;
for(int j = 1;j <= i;j ++){
b= b*j;
}
sum = sum +b;
}
return sum;
}
}
求1到5的阶乘的叠加,要求使用方法完成
最新推荐文章于 2023-01-14 20:12:44 发布