Why is there a difference in output of these two same functions. If you test out factorial(3) and two(3); the factorial gives out list where as two gives out just the number which i want!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void factorial(int num){
cout<<"The factorial of "<<num<<" is ";
int accumulator=1;
for(; num>0; accumulator*=num--){
cout<<accumulator<<endl;
}
}
void two(int number){
cout << "The factorial of " << number << " is ";
int accumulator = 1;
for (; number > 0; accumulator *= number --);
cout << accumulator << ".\n";
}