Procedure to add two numbers in a recursive manner, C/C++ Programming

(a) Write a procedure called (add x y) that adds two numbers in a recursive manner. Specifically, note that x + y = (x + 1) + (y - 1) and x + 0 = x.

(b) Using the substitution model, and applicative order evaluation, show how (add 4 3) works.

(c) Using (a), write a procedure called (add3 x y z) that adds 3 numbers together.

(d) Using the substitution model, and applicative order evaluation, show how (add3 3 2 1) works.

 

Posted Date: 3/25/2013 1:47:03 AM | Location : United States







Related Discussions:- Procedure to add two numbers in a recursive manner, Assignment Help, Ask Question on Procedure to add two numbers in a recursive manner, Get Answer, Expert's Help, Procedure to add two numbers in a recursive manner Discussions

Write discussion on Procedure to add two numbers in a recursive manner
Your posts are moderated
Related Questions
C Program for FUNCTION  OF COMPOUND INTEREST float ci(float,float,float); void main() {           float p=0,r=0,n=0,k=0;           clrscr();           printf("EN

In this lab, please complete a given program to perform the following tasks: 1. Allocate a 10 by 5 2D byte array dynamically. The way of allocation must be consistent with pag


Question: (a) (i) What is recursion? (ii) What advantage is there in its use? (iii) What disadvantage is there in its use? (b) The factorial of a positive number can b

code for solving optimal solution for matrix

Write a program to define a matrix: 1. Write a function that takes an integer and calculates and returns the factorial of the integer. The Factorial of a number "n" is compute


Write a Program for Calculating Value of an Integer? For a clear understanding of recursive function we shall see an illustration for calculating value of an integer. main() {

write a c program to solve exanple of lamis therom