The following is a simple code getting a factorial of a number. I have noticed it works with or without the return at the end of my function block ("return number"). Is there any differences to use it or not, and if not then what is the standard practice?
# include <iostream>
int factorial(int number){
if (number == 1){
return 1;
}
else {
number = number * factorial (number -1);}
return number;
}
int main(){
std:cout << "Enter your number: ";
int number; std::cin >> number;
std::cout << "\n" << factorial (number) << "\n";
}