Powered By Blogger

Feb 11, 2025

7. Fibonacci Series

 #include <stdio.h>

int main() {

    int n, t1 = 0, t2 = 1, next;

    printf("Enter the number of terms: ");

    scanf("%d", &n);

    for (int i = 1; i <= n; ++i) {

        printf("%d ", t1);

        next = t1 + t2;

        t1 = t2;

        t2 = next;

    }

    printf("\n");

    return 0;

}


No comments:

Post a Comment

Featured Post

Data Analysis

    What is data analysis and its significance?   Data analysis is the process of collecting, transforming, and organizing data to dr...

Popular Posts