Friday, 1 September 2017

Series Program - 12

1 3 8 15 27 50 92 169 311

#include<stdio.h>


void main()
{
    int a=1, b=3, c=4, n=10, sum, i;
    printf("%d %d ",a,b,c);
    for(i=4; i<=n; i++)
    {
        sum = a+b+c;
        printf("%d ",sum);
      a = b;
      b = c;
      c = sum;
    }
}

No comments:

Post a Comment