Output a specified number of Fibonacci series in C language

Output a specified number of Fibonacci series in C language

int fibonacci_sqe(int n)
{
    int i, n, t1 = 0, t2 = 1, nt;

    for (i = 1; i <= n; ++i) {
        printf("%d, ", t1);
        nt = t1 + t2;
        t1 = t2;
        t2 = nt;
    }

    return 0;
}

Comments

Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example