Thursday , September 21 2017
Home / C / C program to add two numbers using recursion method

C program to add two numbers using recursion method

C program to add two numbers using recursion method | Without using Arithmetic operator : 

This is a C program using recursion method for adding two numbers. Recursion method has always been difficult for many. So you can get the code here and understand on our own.

Also Read: Swap two numbers without using third variable

#include<stdio.h>

int sum(int, int);
int main() {
   int num1, num2;

   printf("\nEnter the two Numbers : ");
   scanf("%d %d", &num1, &num2); //Enter two numbers 

   printf("\nSum of two num is : %d", sum(num1, num2)); //user defined function is now called
   return (0);
}

int add(int num1, int num2) // the two values are now passed in to this function whose output will be sent back to the method called
{
   if (!num1)
      return num2;
   else
      return sum((num1 & num2) << 1, num1 ^ num2);
}

Incoming search terms :

C program to add two numbers using recursion method,

WAP in c to sum up two numbers using recursion

Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

Leave a Reply

Your email address will not be published. Required fields are marked *