100% C prog Hemachandra (Fibonacci) series

// Online C compiler to run C program online
#include <stdio.h>

void main()
{
  int i,n,old1,old2,new;
  old2=0;
  old1=1;
  printf("\n enter no. of terms greater than 2:");
  scanf("%d",&n);
  printf("hemachandra series= %3d,%3d",old2,old1);
  for(i=2;i<n;i++)
  {
    new=old1+old2;
     old2=old1;
     old1=new;
    printf(",%3d",new);
  }
}
ఔట్పుట్  తెరమీద 

enter no. of terms greater than 2:7
hemachandra series=   0,  1,  1,  2,  3,  5,  8


enter no. of terms greater than 2:9
hemachandra series=   0,  1,  1,  2,  3,  5,  8, 13, 21

కామెంట్‌లు

ఈ బ్లాగ్ నుండి ప్రసిద్ధ పోస్ట్‌లు

Useful books in telugu

ధన్యవాదములు.. కాస్త తెలుగు కూడా ఉపయోగించమ్మా.. Re: Assignment 1

Useful books from Ramakrishna mission (telugu & Hindi)