I download the tutorial in this site.I got a proplems in understanding this code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream> // factorial calculator
usingnamespace std;
int add (int a) // proplems start here
{
if (a>1)
return a*add (a-1); //this is the big proplem
elsereturn 1;
} // end here
int main ()
{
int x;
cin >> x;
cout << add (x);
return 0;
}
i want someone to tell me how this code work.
please answer my question fast
What do you want to know? It takes input from the user on line 12 and passes it to the add(...) function on line 13. From here the code executes Line 3 through Line 8. Do you have a specific question?