// factorial calculator
#include <iostream>
using namespace std;
long factorial (long a)
{
if (a > 1){
return (a * factorial (a-1)); }//function calling itsself
else
return 0;
}
main ()
{
long number = 2;
cout << number << "! = " << factorial (number);
}
i am begginer learning objects and classes. i get some code from my context but its getting some error. how return statement is working when its value is 0 out put becomes 0 when it is return 1 output is 2. when it is return 3 output is 6 similar for 4 is 8.