New course! Every coder should learn Generative AI!
Try a free lesson0
Factorial
I want to know source code of factorial in C++
2 Answers
+ 9
int num;
int result = 1;
cin >> num;
for (int i = 1; i <= num; i++)
{
result *= i;
}
cout << result;