+ 1

Factorial ??

code of how calculate the factorial

3rd Mar 2017, 12:41 AM
El missouri
El missouri - avatar
4 ответов
+ 1
Rain, that's C++, not C#.
4th Mar 2017, 5:14 AM
1of3
1of3 - avatar
0
#include <iostream> using namespace std; int factorial(int num){ if(num > 1){ num *= factorial(num - 1); } else { return num; } } int main() { int num; int sum = 0; cout << "Input number to get factorial of: "; cin >> num; cout << num << endl; sum = factorial(num); cout << "The factorial of " << num << " is "<<sum; }
3rd Mar 2017, 1:17 AM
Rain
Rain - avatar
0
Check out my codes. Its is in java, but
3rd Mar 2017, 4:28 AM
Meharban Singh
Meharban Singh - avatar
0
@1of3: Oh, I didn't notice the tag, I just thought in general
4th Mar 2017, 5:33 PM
Rain
Rain - avatar