package until4;public class one { public static void main(String[] args) { // TODO Auto-generated method stub? ? ? ? for(int i=1;i<=30;i++){? ? ? ? int sum=0;? ? ? ? sum=sum+fun(i);? ? ? ? System.out.println(sum);? ? ? ? }? ? ? ?public static int fun(int a){? ? ? if(a>1){? ? return ?a*fun(a-1);? ? ? }? ? ? else? ? ? return 1;? ? ? ?}? ? ? ? } }
3 回答
已采納

think008
TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊
package?until4; public?class?one?{ ????public?static?void?main(String[]?args)?{ ????//?TODO?Auto-generated?method?stub ????????????for(int?i=1;i<=30;i++){ ????????????????int?sum=0; ????????????????sum=sum+fun(i); ????????????????System.out.println(sum); ????????????} ????} ???? ????public?static?int?fun(int?a){ ??????if(a>1){ ???????????return??a*fun(a-1); ??????}else ??????????return?1; ????} ???? }
添加回答
舉報(bào)
0/150
提交
取消