Explain me the result of this C++ code
Budget: $10 – $30 USD
Hello,
I need someone to explain me in detail why the code below returns 01101
#include <iostream>
using namespace std;
void f(int x)
{
while(x>1)
{
x=x-1;
f(x-1);
}
cout<<x;
}
int main()
{
f(4);
}
I will pay 10 USD
I need someone to explain me in detail why the code below returns 01101
#include <iostream>
using namespace std;
void f(int x)
{
while(x>1)
{
x=x-1;
f(x-1);
}
cout<<x;
}
int main()
{
f(4);
}
I will pay 10 USD