answersLogoWhite

0


Best Answer

I am a beginner at C++ but my professor gave us a similar one to this which was to display 4321. So i just modified it to fit your satisfaction.

Code:

void f(int n)

{

cout<<n;

if(n<=4) f(n+1);

}

calling statement: f(1) Output:1234

Trace :

f(1)

/ \

1 f(2)

/ \

2 f(3)

/ \

3 f(4)

/

4

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How to write a recursive void-function that has one parameter which is a positive integer When called the function writes its argument to the screen backward That is if the argument is 1234 it outputs?
Write your answer...
Submit
Still have questions?
magnify glass
imp