Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#27 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@tanujb03 is already working on this.

Since Oct 10, 2026.

  • #31 by @tanujb03 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c, cpp, go, python
Domain
backend

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
1
Forks
6
Avg merge
17h 52m
Merged PRs (30d)
14

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from techcsispit/code-corner

All issues in techcsispit/code-corner

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.