Search
 
SCRIPT & CODE EXAMPLE
 

C

fibonacci series in c using recursion

#include<stdio.h>
int main()
{
int first=0, second=1, i, n, sum=0;
printf("Enter the number of terms: ");
scanf("%d",&n);
//accepting the terms
printf("Fibonacci Series:");
for(i=0 ; i<n ; i++)
{
if(i <= 1)
{
sum=i;
}
//to print 0 and 1
else
{
sum=first + second;
first=second;
second=sum;
//to calculate the remaining terms.
//value of first and second changes as new term is printed.
}
printf(" %d",sum)
}
return 0;
}
Comment

recursive fibonacci in c

int fibbonacci(int n) 
{
   if(n == 0 || n == 1)
      return n;
   else
      return (fibbonacci(n-1) + fibbonacci(n-2));
}
Comment

PREVIOUS NEXT
Code Example
C :: ansi c function array of strings parameter 
C :: Minimum Distance between words[AMAZON] 
C :: resto de division recursiva 
C :: anthracnose pronounce 
C :: onvert a string into 2d string in c 
C :: how to find folders from a c program 
C :: convert calendar time to epoch in c programming 
C :: C (GEM) 
C :: ejemplo c holamundo 
C :: can we update values of a map via traversing 
C :: temperature sensor data 
C :: ESP32 timerBegin(0, cpuClock, true); 
C :: difference between %d and %i 
C :: 25802 WARNING: lib not found: _pywrap_tensorflow_internal.pyd dependency of D:Devtoolsminicondalibsite-packages ensorflowpythonclient\_pywrap_tf_session.pyd 
C :: send array through a pipe 
C :: data breach 
C :: Single-line Comments in C 
C :: c# Regex similar wor 
C :: String insertion into another string 
C :: C programming statician 
C :: c static variable 
C :: come fare un programma in c con cui interagire 
C :: Typecast Operator in C language 
C :: recursion c prime number 
Dart :: How to create a round CheckBox in Flutter 
Dart :: java utils wait for seconds 
Dart :: flutter textfield outlineinputborder 
Dart :: two dots dart 
Dart :: Flutter - BoxShadow Widget 
Dart :: flutter button with icon 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =