C program to Print Fibonacci series

Write a program in the C programming language to print Fibonacci series up to the inputted number by using for loop statement. Below is the solution of the C program –

/* C program to print the fibonacci series*/
     int f1,i,f2,f3,n;

      printf("upto which no.you want series");
      printf("%d \t %d \t",f1,f2);

Description – For loop is used to print the series up to n. First two terms of the Fibonacci series are initialized in the compile time initialization and from the first two terms the rest of the terms are created. After creating the new term ‘ f3 ‘; it is printed. The value of the new term and it’s previous term is stored in ‘ f2 ‘ and ‘ f1 ‘ so that the next new term can be created from these variables.
Input – 12
Output – 0   1   1   2   3   5   8   13   21   34   55   89

yashan has written 69 articles

3 thoughts on “C program to Print Fibonacci series

  1. Fanny says:

    2 décembre 2011Je trouve ça très chiant d’avoir un ajout automatique des groupes, j’ai plus de 1000 &lbp;ou&nasq;amis » et tous les jours j’ai le droit à un groupe de plus, du plus farfelu au plus inutile. Personnellement ça me gonfle !

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>