Math, asked by poojasakrola86964, 2 months ago

Note: -
What is the output of the program?
#include <iostream>
using namespace std;
void Abc (int x)
{
if (x<=0)
{
return;
}
Abc (x-1);
cout<<x;
Abc (x-1);
}
int main() {
Abc (3);
return 0;
}​

Answers

Answered by eashanmorajkar2006
0

Answer:

The output will be 2.

Step-by-step explanation:

When the function ia called ABC is given a value of 3.

In the ABC function x us not equal to zero so the if function will not work next the value of x is decreased by 1 and then printed which will give output 2 and next it is again decreased by 1 which will make x equals 1 but there is not coût function so it will not print 1.

Similar questions