Re: [問題] 台聯大考古題
※ 引述《hwamond (a-Hwa)》之銘言:
: public class Program1{
: public Program1()
: {
: system.out.println(cal(10,25));
: }
: public static void main(String args[])
: {
: Program1 program = new Program1();
: }
: public int cal(int a,int b)
: {
: if(b==1) return a;
: else return a+cal(a,b-1);
: }
: }
: 請問他的結果是什麼@@a
: 煩請解答 謝謝
不好意思 這篇借用一下
請問有抓蛙魔人可以解釋一下嗎^^"
其實我比較不懂的是
else return a+cal(a,b-1);
這行 :)
--
IE7 http://ie7.com
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.71.22.20
→
06/26 17:36, , 1F
06/26 17:36, 1F
→
06/26 18:49, , 2F
06/26 18:49, 2F
→
06/27 11:18, , 3F
06/27 11:18, 3F
→
06/27 12:14, , 4F
06/27 12:14, 4F
討論串 (同標題文章)