Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit 859a8a6

Browse files
Create for_loop_fibonnaci
A simple program using for loop to print fibonacci sequence till nth member of the sequence
1 parent f8c5ddb commit 859a8a6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

simple_scripts/for_loop_fibonnaci

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#printing fibonnaci series till nth element
2+
def print_fibonacci(n):
3+
current_no = 1
4+
prev_no = 0
5+
for i in range(n):
6+
print(current_no, end = " ")
7+
prev_no,current_no = current_no, current_no + prev_no
8+
9+
print_fibonacci(10)

0 commit comments

Comments
 (0)