**C programs on recursion. Collections of function recursion programs source code examples in c programming language frequently asked in interview**

Sum of n numbers using recursion in c

Sum of n numbers using recursion in c

Subscribe to:
Post Comments (Atom)

The best c site i have ever seen in my life

ReplyDeleteI think so

Deletereally it is best!!!

Deleteit helps always..

ya best site......

ReplyDeleteNice site. Very good for beginners....

ReplyDeleteone of the best site.....

ReplyDeleteloved this site.....thumbs up to the ppl who created this...

ReplyDeletethe best site... :)

ghanta mera....

Deletereally great site

ReplyDeletehaa were are u from???

Deletenahi

Deleteyes this is best c site which contains useful data.

ReplyDeletereally THE BEST site for c learners............thanks a lot to the one who created this site

ReplyDeletewhoever created this site looked at every aspect of a problem

ReplyDeletea great site for c learners

thank u :)

_/\_ for this site and creator...

ReplyDeletethe best c programming and very flexible answers

ReplyDeletewrite a C program for Tower of Hanoi problem with a example of 4 disks .

ReplyDeletebest site for ever..............very very helpful for all level programmers ....thank you sir

ReplyDeletegreat site it is....thank u sir...

ReplyDeletethank very much author

ReplyDeletereally helpful

ReplyDeletehello everbody ,

ReplyDeletei am having doubt in tower of hanoi .i tried every site for understanding tower of hanoi

but none worked.

following is the program

#include "stdio.h"

void towers(int,char,char,char);

void towers(int n,char frompeg,char topeg,char auxpeg)

{ /* If only 1 disk, make the move and return */

if(n==1)

{ printf("\nMove disk 1 from peg %c to peg %c",frompeg,topeg);

return;

}

/* Move top n-1 disks from A to B, using C as auxiliary */

towers(n-1,frompeg,auxpeg,topeg);

/* Move remaining disks from A to C */

printf("\nMove disk %d from peg %c to peg %c",n,frompeg,topeg);

/* Move n-1 disks from B to C using A as auxiliary */

towers(n-1,auxpeg,topeg,frompeg);

}

main()

{ int n;

printf("Enter the number of disks : ");

scanf("%d",&n);

printf("The Tower of Hanoi involves the moves :\n\n");

towers(n,'A','C','B');

return 0;

}

In the function tower ,there has been 2 recursive function call,does the statement below 1st

recursive function gets executed if yes then how?

please explain step wise as i am new to programming.

Regards

#include

Deletevoid move(int n,char s,char d)

{

printf("Move the %d plate from %c to %c\n",n,s,d);

}

void toh(char s,char d,char u,int n)

{

if(n!=0)

{

toh(s,u,d,n-1);

move(n,s,d);

toh(u,d,s,n-1);

}

else

return;

}

void main()

{

toh('A','B','C',4);

}

ultimate site for c learners !!!!

ReplyDeleteThank you... It helped me a lot!!!

ReplyDeleteGreat.. thank you very much

ReplyDeleteComment should not be empty

ReplyDeleteCan anyone tell me about the best site for c++ and data structure as this site is for c????. thankss

ReplyDeletereally awestruck site i had ever seen for learning c..!! thanks alot.

ReplyDeleteSUPERB SITE!!!! THANK U SO MUCH.I WAS ABLE TO FIND ALL THE SOLUTIONS FOR ALL C PROGRAMS!!! :-D

ReplyDeletehello anyone to sugegst me book with solved exercises in recutions??i be grateful for that help!!thanks

ReplyDelete?

ReplyDelete/and list of best books with solved problems in data structurs using c

very very helpful........thankyou for creating this site

ReplyDeletehelped me a lot........._/\_ thank you

1) Write a program with dedicated functions to find the sum of the following series:

Deletea. 2, 5, 7, . . ., 2N + 1

b. -2, 4, 46, . . ., 6n3 – 2

Note that the functions must be written as a recursive functions.

how to solve this?

2) Write a program to solve the following algebraic formula in a recursive form.

ReplyDeletey = 1 – x + x2/2 – x3/6 + x4/24 + . . . + (-1)nxn/n!

You may have to write and use a factorial function in this program.

Note that the factorial function must also be written as a recursive function.

Write a programme to generate:

ReplyDeleteA

A B

A B C

A B C D

A B C D E

#include

Delete#include /*for getch()*/

void main()

{

int n;

int k;

int i;

printf("\n enter the no of rows");

scanf("%d",&n);

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

{

printf("\n");

for (k='A';k<='A'+i;k=k+1)

printf("%c",k)

}

getch();

}