iT邦幫忙

0

用C語言完成任意階數的巴斯卡三角形

  • 分享至 

  • xImage

想問一下大家,該如何用C語言寫出任意階數的巴斯卡三角形?
例如:
Input: rowIndex = 3

Output: [1,3,3,1]

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
海綿寶寶
iT邦大神 1 級 ‧ 2022-05-11 17:29:43
看更多先前的回應...收起先前的回應...

https://ithelp.ithome.com.tw/upload/images/20220511/20148564s8TPWnEqIY.png

我弄出來還是怪怪的?

我看是蠻好的
https://ithelp.ithome.com.tw/upload/images/20220511/20001787luyeaYbeTU.png

我弄出來還是怪怪的?

把 getch(); 那列刪掉即可

canrong iT邦新手 3 級 ‧ 2022-05-12 09:47:29 檢舉

依照網頁的解題思路索引從0開始,但發文人的索引應該是從1開始吧?那麼公式要稍微注意一下了。

我弄出來的第一列好像會跑掉?https://ithelp.ithome.com.tw/upload/images/20220514/20148564hD3OduppGt.png

我要發表回答

立即登入回答