c program to print given number pattern

Write a c program to print given number pattern
1
1 2
3 5 8
13 21 34 55
89 144 233 377 610
987 1597 2584 4181 6765 10946

#include<stdio.h>

int triangle(int a)
{
  if(a<=1)
    return a;
  return(triangle(a-1)+triangle(a-2));
}

int main()
{
  int i,m,k=1;
  for(i=1;i<=5;i++)
  {
    for(m=1;m<=i;m++)
    {
      printf("%d ",triangle(k++));
    }
    printf("\n");
  }
}

Copyright © C Program | Java | OpenGL Programming | Hadoop at Computaholics