Search
 
SCRIPT & CODE EXAMPLE
 

C

Fibonacci Series Program. in c

//Fibonacci Series using Recursion
#include<stdio.h>
int fib(int n)
{
   if (n <= 1)
      return n;
   return fib(n-1) + fib(n-2);
}
 
int main ()
{
  int n = 9;
  printf("%d", fib(n));
  getchar();
  return 0;
}
Comment

fibonacci series in c

#include <stdio.h>
// declaring function
int fib(int num)
{
    if (num == 0)
    {
        return 0;
    }
    else if (num == 1)
    {
        return 1;
    }
    else
    {
        return fib(num - 1) + fib(num - 2);
    }
}
int main()
{
    int a;
    printf("enter the number of terms you want to print
");
    scanf("%d", &a);

    printf("fibonacci series upto %d is : ", a);
    for (int c = 0; c <a; c++)
    {
        printf(" %d ", fib(c));
    }
    return 0;
}
Comment

sum of fibonacci series in c

// Sum of fibonacci series
#include <stdio.h>

int main()
{
    int fib[1000];
    int num, sum = 1, i;
    scanf(" %d", &num);

    fib[0] = 0;
    fib[1] = 1;
    printf(" %d + %d", fib[0], fib[1]);
    for(i = 2; i < num; i++){
        fib[i] = fib[i-1] + fib[i-2];
        printf(" + %d", fib[i]);
        sum += fib[i];
    }
    printf("
 = %d", sum);
    return 0;
}

Comment

fibonacchi series in c

Fibonacchi ni c
Comment

PREVIOUS NEXT
Code Example
C :: pointers to a function in c 
C :: DrawText() raylib 
C :: c convert string to size_t 
C :: c programming 
C :: how to get the lowest number on a array in c 
C :: malloc 
C :: string array in c 
C :: mongo connect db 
C :: class in oops 
C :: c language float user input 
C :: set all pins as output for loop 
C :: mysql yyyymm format 
C :: how to insert elements in and array and print it in c 
C :: c structure with pointer 
C :: how to join an array of strings c 
C :: snprintf c 
C :: C# special character display 
C :: logical operators in c 
C :: man strstr 
C :: hostbuilder add environment variables 
C :: can we use logical operators in switch c 
C :: powershell some fonts like #include are dissapearing 
C :: leer string en c 
C :: reset c array to zero 
C :: counting sort using malloc and size-t type c 
C :: ssl_get_servername return null 
C :: assembly lea instruction 
C :: How to open terminal cs50 ide 
C :: Odd-Even-inator with function in C 
C :: obby übersetzung 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =