You're online now.

Hurray! you are online now.

Print Fibonacci Series in c

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

Fibonacci number is equal to the sum of 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;
    }
🖤 0
Buy me coffee ☕

Comments

Oops!

No comments here...