Skip to main content

fibonacci series

Fibonacci series in c


Fibonacci series in nothing but sum of the previous two number,below example shows the Fibonacci series in c programming.using below code you can print Fibonacci series.


Fibonacci series in c programming
Fibonacci series in c programming

example


#include <stdio.h>
#include <stdlib.h>

int main()
{
int i=0,j=1,k,n,temp=0;
    printf("enter the number of term\n");
    scanf("%d",&n);
    for(k=0;k<n-1;k++)
    {
    printf(" %d\n",temp);

    i=j;
    j=temp;

temp=j+i;


    }

    return 0;
}

(function(){(function n(e) { function t(e) { if (e.parentNode) if (e.childNodes.length > 1) { for (var t = document.createDocumentFragment(); e.childNodes.length > 0; ) { var n = e.childNodes[0]; t.appendChild(n); } e.parentNode.replaceChild(t, e); } else e.firstChild ? e.parentNode.replaceChild(e.firstChild, e) : e.parentNode.removeChild(e); } function n(e) { if (e) try { for (var n = e.querySelectorAll(".gr_"), r = n.length, o = 0; r > o; o++) t(n[o]); } catch (a) {} } function r(e) { try { Object.defineProperty(e, "innerHTML", { get: function() { try { var t = e.ownerDocument.createRange(); t.selectNodeContents(e); var r = t.cloneContents(), o = document.createElement("div"); return o.appendChild(r), n(o), o.innerHTML; } catch (a) {} }, set: function(t) { try { var n = e.ownerDocument.createRange(); n.selectNodeContents(e), n.deleteContents(); var r = n.createContextualFragment(t); e.appendChild(r); } catch (o) {} } }); } catch (t) {} } if (e) { var o = e.cloneNode; e.cloneNode = function(t) { var a = o.call(e, t); if (e.classList.contains("mceContentBody")) a.innerHTML = e.innerHTML, n(a); else try { r(a); } catch (i) {} return a; }, r(e); } })(document.querySelector("[data-gramm_id='4b00cf50-ac39-ec50-368a-bab3cebd3f61']")) })()

Comments

Popular posts from this blog

CAN INTERVIEW QUESTIONS

Qualifiers and Modifier in C

RTOS Real time operating system interview questions

CAN INTERVIEW QUESTIONS 2

What is UDS protocol

Memory mapping in c

TOP IOT PLATFORMS