Technicalsymposium.com-Free Email Alerts


Enter Your Email :

Important Note:Login & Check Your Email Inbox and Activate Confirmation Link

Subscribe & Get All Fresher Jobs Information & Study Materials PDF and Projects- Free Download

Data Structure Programs PDF


Pointers in C


Tech Interview in Datastructure



Data Structure Programming & Projects PDF- Free Download

/* pgm to compute factorial & generate fibonacci of a number*/

long int fact(int);

int fibo(int);

void main()

{

int n,i,ch;

long int x;

clrscr();

printf("\n\t\tPROGRAM TO COMPUTE FACTORIAL & GENERATE FIBONACCI SERIES\n\n");

do

{

printf("\n\n\tEnter the Number : ");

scanf("%d",&n);

if(n<0)

printf("\n\nInvalid Number.Try Again");

}while(n<0);

printf("\n\t %d ! = %ld\n",n,fact(n));

printf("\n\n\t\tFIBONACCI SERIES\n\n\t");

if(n==0) printf("\n\n\tZERO SERIES CAN'T BE GENERATED\n\n");

else

for(i=1;i<=n;i++)

printf("%d\t",fibo(i));

getch();

}

long int fact(int n)

{

if(n==0 || n==1)

return 1;

else

return(n*fact(n-1));

}

int fibo(int n)

{

if(n==1) return 0;

else if(n==2) return 1;

return(fibo(n-1)+fibo(n-2));

}

Download All Data Structure Study Materials & ebook PDF



Data Structure