From fccad49335858db52b864928c62911c9e7579d86 Mon Sep 17 00:00:00 2001 From: Aditya Narayan nayak <72183256+Aditya-Narayan-Nayak@users.noreply.github.com> Date: Sat, 2 Oct 2021 17:18:21 +0530 Subject: [PATCH] fibonacci updated --- app.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 3428f26..2c28db3 100644 --- a/app.py +++ b/app.py @@ -59,7 +59,30 @@ def palindrome(): else: print("Not Palindrome") - def armstrong(): +def fibonacci(n): + a = 0 + b = 1 + + if n < 0: + print("Incorrect input") + + + elif n == 0: + return 0 + + + elif n == 1: + return b + else: + for i in range(1, n): + c = a + b + a = b + b = c + return b + +print(fibonacci(int(input("Enter the input)) + +def armstrong(): n = int(input("Enter a number")) order = len(str(n)) sum = 0