Question: #6 Trace the following program and show the output. #include #include #include void counting1(int); void counting2(int); void counting3(int); void main() { int temp; cout <

#6 Trace the following program and show the output.

#include #include #include void counting1(int); void counting2(int); void counting3(int); void main() { int temp; cout << "Enter a value for counting "; Enter 5 cin >> temp; counting1(temp); // function call cout << endl; counting2(temp); // function call cout << endl; counting3(temp); // function call

} void counting1(int n) { // Assume n is 5 to start with if (n > 0) { cout << setw(5) << n; counting1(n - 1); cout << setw(5) << n; } else cout << setw(5) << n; } void counting2(int m) // Assume m is 5 to start with { if (m >= 0) { cout << setw(5) << m; counting2(m - 1); }; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!