Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fibonacci #111

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Check out the [examples](examples/README.md):
- [Fizz Buzz](examples/fizz_buzz.brainrot)
- [Bubble Sort](examples/bubble_sort.brainrot)
- [One-dimensional Heat Equation Solver](examples/heat_equation_1d.brainrot)
- [Fibonacci Sequence](examples/fibonacci.brainrot)

## 🗪 Community

Expand Down
36 changes: 35 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,38 @@ skibidi main {
- Conditional checking with `edgy`/`amogus`.


Feel free to explore and modify each example to learn more about how this language’s syntax and features work!
## Fibonacci Sequence
**File name:** `fibonacci.brainrot`

```
skibidi main{
rizz first = 0;
rizz second = 1;
rizz next;
rizz count = 0;
rizz limit = 10;

yapping("%d", first);
yapping("%d", second);
count = count + 2;

goon(count < limit){
next = first + second;
yapping("%d", next);

first = second;
second = next;

count = count + 1;
}

bussin 0;
}
```
### What it does
- Prints the first 10 numbers of fibonacci sequence (`limit` variable).
- Initializes `first` and `second` terms with 0 and 1.
- Using a `goon` loop to find the next numbers, until limit.


Feel free to explore and modify each example to learn more about how this language’s syntax and features work!
23 changes: 23 additions & 0 deletions examples/fibonacci.brainrot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
skibidi main{
rizz first = 0;
rizz second = 1;
rizz next;
rizz count = 0;
rizz limit = 10;

yapping("%d", first);
yapping("%d", second);
count = count + 2;

goon(count < limit){
next = first + second;
yapping("%d", next);

first = second;
second = next;

count = count + 1;
}

bussin 0;
}
Loading