100年普考程式設計概要? - 普考
By Ophelia
at 2013-05-25T23:17
at 2013-05-25T23:17
Table of Contents
[考題] 國考歷屆考題與考題觀念討論(書裡看到的選這個)請附上想法、出處
出處:如題
void mystry(int n )
{
if(n!=0)
{
mystery(n/2);
putchar('0'+n%2);
}
return;
}
假設n =10,
那遞?呼叫 m(10)->m(5)-m(2)->m(1)->m(0) return
m(10) pubchar('0'+n%2)= 00
m(5) 01
m(2) 00
m(1) 01
那這樣回傳時不是 010001嗎???
可是答案是十進制轉二進制,那應該是1010,請問是我那裡理解錯了嗎?
--
出處:如題
void mystry(int n )
{
if(n!=0)
{
mystery(n/2);
putchar('0'+n%2);
}
return;
}
假設n =10,
那遞?呼叫 m(10)->m(5)-m(2)->m(1)->m(0) return
m(10) pubchar('0'+n%2)= 00
m(5) 01
m(2) 00
m(1) 01
那這樣回傳時不是 010001嗎???
可是答案是十進制轉二進制,那應該是1010,請問是我那裡理解錯了嗎?
--
Tags:
普考
All Comments
By Tracy
at 2013-05-30T17:03
at 2013-05-30T17:03
By Mary
at 2013-06-01T23:39
at 2013-06-01T23:39
By Lydia
at 2013-06-02T12:00
at 2013-06-02T12:00
Related Posts
基本電學/89年普考
By Sandy
at 2013-05-25T21:46
at 2013-05-25T21:46
稅務特考三等(台北市)
By Carolina Franco
at 2013-05-25T20:34
at 2013-05-25T20:34
行政法選擇題的準備方針
By Ina
at 2013-05-25T18:52
at 2013-05-25T18:52
102關務化工三等上榜心得
By Skylar Davis
at 2013-05-25T14:26
at 2013-05-25T14:26
證照組高普考 考選部盼年底辦
By Ina
at 2013-05-25T12:30
at 2013-05-25T12:30