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

Damjibhai and Shamjibhai are two jeweler friends. They decide to play a simple game. The game comprises of removing the jewels for polishing, turn by turn. Once a jewel is removed

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t


Stage One Define the specification of the program            Add two nxm size matrices   Stage Two Divide the program up into separate modules           Input Matrix         Ad

Dereferencing the Pointer this Sometimes a member function requires to make a copy of the invoking instance so that it can change the copy without affecting the original instan

Define Storage Classes of c program - computer programming? Each variable and function in C language has two attributes that are type and storage class. If storage class of a v

Aim: To implement a program to display a rectangle, circle and triangle. Code:                       class shape {             public:                         vir

Rule: To determine the canonical form we should OR the min terms. A min term is defined as a Boolean equation of the input if the output is logic '1'. If the input is logic '1'

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome