C Program For Addition Using Recursion

  #include<stdio.h>
  int add(int,int);
  void main()
  {
  int a,b;
  printf("a,b");
  scanf("%d%d",&a,&b);
  printf("SUM =%d", add(a,b));
  }
  int add(int a,int b)
  {
  if(b==1)
  return a+1;
  else
  return add (a+1,b-1);
  }

Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.

No comments:

Post a Comment