patternprogram_57 softethics

Pattern 57 (Fibonacci Series)

C

#include<stdio.h>

int main()
{
  int i,j;
  int n1=0,n2=1,r=n1+n2;


  for(i=1; i<=5; i++)
  {
    for(j=1; j<=i; j++)
    {

      printf("%d ",r);
      r=n1+n2;
      n1=n2;
      n2=r;
    }
    printf("\n");
  }

}

C++

Java

C#

Python

0 0 votes
Rate this Program
Subscribe
Notify of
guest


0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments