Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#27 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@tanujb03 arbeitet bereits daran.

Seit 10.10.2026.

  • #31 von @tanujb03 — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
c, cpp, go, python
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
1
Forks
6
Ø Merge
12 Std. 42 Min.
Gemergte PRs (30 T.)
10

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus techcsispit/code-corner

Alle Issues in techcsispit/code-corner

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.