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 :: char to int in c 
C :: C program to check whether character is lowercase or not using ASCII values 
C :: print variable adress c 
C :: lateinit kotlin 
C :: c convert float to string 
C :: bootstrap 4 forms 
C :: Bootstrap textarea from 
C :: How to pass a struct value to a pthread in c? 
C :: c typedef 
C :: stack push 
C :: add to beginning of array c 
C :: how to change background color in c programming 
C :: how to empty array in c 
C :: Program to Check Whether Character is Lowercase or Not without using islower function 
C :: pendu langage c 
C :: leggere stringhe con spazio in mezzo c 
C :: how to input till end of line in c 
C :: esp32 dhcp server 
C :: how to read from a file in c 
C :: how to debug a segmentation fault in c 
C :: pointer c 
C :: ubuntu ocaml install 
C :: gandhi ashram saharanpur 
C :: Highest integer among the four inputs in c 
C :: convert c code to assembly language 
C :: how to link flexslider 
C :: Greatest common divisor iterative 
C :: c to assembly converter online 
C :: c program boilerplate code 
C :: timespec c 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =