Description

Fibonacci numbers ( sequence ) is a set of numbers that start with 1 or 0 followed by a 1 proceeds on the rule that each number. 

Fibonacci number is equal to the sumof the preceding two numbers.

F(n) = 0, 1, 1, 2, 3, 5, 8, 13......

Write a program to find the fibonacci series the given number ( size of series ) by user.

#include<stdio.h>

int main(){
    int n;
    printf("Enter the size of series : ");
    scanf("%d", &n);
    int a=0, b=1, c;
    printf("%d %d", a, b);
    
    for(int i=2; i<n; i++){
        c = a + b;
        a = b;
        b = c;
        printf(" %d", c);
    }
    return 0;
}

Output :

Enter the size of series : 10
0 1 1 2 3 5 8 13 21 34

Comments

Login is mandatory to comment Please login

Recommended Posts

Palindrome | Palindrome program in c | Palindrome Number

Write a program in c to check that the given number is palindrome or not?

Pascal Triangle | C programming

pascal triangle program in c | Write a c program to print the pascal triangle.

Leap Year | Leap year program in c

Year is divisible by completely 4,100,400 then called that year is leap year.

Perfect Number in C Programming

What is Perfect Number? Perfect Number is a positive integer number that is equal to the sum of the its possible factors.
For Example : 6 is a Perfect Number

Strong Number in C programming | What is Strong Number

Strong Number is a number whose sum of the factorial of digits of number is equal to given number.
For Example : 145 is a strong number.

Neon Number | c programming language

A neon number is a number if the sum of the square of that number is equal to the actual number, then it is a neon number. For Example : 9 is a neon number.