Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

fibonacci/solution.c: prints negative numbers for n of 47 or more (F(90) prints -1581614984)

已關閉
#27 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@tanujb03 已經在處理了。

開始於 2026年10月13日。

  • #31 來自 @tanujb03 —— 未關閉
  • #45 來自 @VatsalRaina01 —— 已合併

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
25/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
c, cpp, go, python
領域
backend

研究方向

Start in problems/fibonacci/solution.c, where the value is computed in a type too narrow for F(47) and above, and compare with the Go, C++ and Python solutions. Add the failing inputs (47, 79, 90) to problems/fibonacci/cases.txt, then run python3 run.py fibonacci. Done when those inputs print 2971215073, 14472334024676221 and 2880067194370816120. Pull request #31 is already open against this, so check it before starting.

由索引模型根據 Issue 內容生成。

描述

bug good first issue

What I did

  1. Fresh checkout of main, a C compiler.
  2. Compile and run the C solution:
cd problems/fibonacci
gcc solution.c -o fib
echo 46 | ./fib
echo 47 | ./fib
echo 79 | ./fib
echo 90 | ./fib

What I expected
The problem README says: "Read n (0 <= n <= 90) and print the nth Fibonacci number ... F(90) is 2880067194370816120, so think about which number type can hold it." (problems/fibonacci/README.md)

So 47 should print 2971215073, 79 should print 14472334024676221, and 90 should print 2880067194370816120.

What happened instead

46 -> 1836311903        (correct)
47 -> -1323752223
79 -> -660827267
90 -> -1581614984

Every n from 47 to 90 is wrong. The Go, C++ and Python solutions print the correct values. python3 run.py fibonacci passes today because cases.txt has no input above 46.

Environment
code-corner main @ 0c95800, gcc 16.2, Windows 11.

I'd like to work on the fix for this, and add the failing inputs to cases.txt as the Contributing section asks.

主要語言
Python
星號
1
分支
6
平均合併
23 小時 30 分鐘
30 天內合併 PR
20

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

techcsispit/code-corner 的其他 Issue

查看 techcsispit/code-corner 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。