From a7bee38c9f59b42ce66df501a4b31dea5c03d576 Mon Sep 17 00:00:00 2001 From: arunak391 <118095481+arunak391@users.noreply.github.com> Date: Tue, 15 Nov 2022 12:32:18 +0530 Subject: [PATCH] Fibonacci series Fork created --- fibinacciseriesFork_Aruna.K | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 fibinacciseriesFork_Aruna.K diff --git a/fibinacciseriesFork_Aruna.K b/fibinacciseriesFork_Aruna.K new file mode 100644 index 0000000..8f5ff5d --- /dev/null +++ b/fibinacciseriesFork_Aruna.K @@ -0,0 +1,20 @@ + #include +void printFibonacci(int n){ + static int n1=0,n2=1,n3; + if(n>0){ + n3 = n1 + n2; + n1 = n2; + n2 = n3; + printf("%d ",n3); + printFibonacci(n-1); + } +} +int main(){ + int n; + printf("Enter the number of elements: "); + scanf("%d",&n); + printf("Fibonacci Series: "); + printf("%d %d ",0,1); + printFibonacci(n-2);//n-2 because 2 numbers are already printed + return 0; + }