Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Example of recursive function

Posted By: Rainer Fischer     Category: C Programming     Views: 5443

Example of recursive function.

Code for Example of recursive function in C Programming

#include <stdio.h>
int add(int pk,int pm);
main()
{
 int k ,i,m;
 m=2;
 k=3;
 i=add(k,m);
 printf("The value of addition is %d\n",i);
}
int add(int pk,int pm)        
{
if(pm==0) return(pk);        \\ A
elsereturn(1+add(pk,pm-1));    \\ B
}
  
Share: 


Didn't find what you were looking for? Find more on Example of recursive function Or get search suggestion and latest updates.

Rainer Fischer
Rainer Fischer author of Example of recursive function is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!