20160721

Add Two Number Using Recursion

#include <stdio.h>
#include <conio.h>
int y;
add(int m,int n)
  { if(n==0)
     return m;
    y=add(m,n-1)+1;
    return y;
  }
main()
  { int a,b,r;
    printf("enter the two numbers : ");
    scanf("%d%d",&a,&b);
    r=add(a,b);
    printf("Sum of two no :%d",r);
    return 0;
  }


OUTPUT

enter the two numbers : 3 2
Sum of two no :5

Disqus Shortname

Recent Post Number

Related Post Number

Comments system