1 Write a function in C++ to find the factorial of a number (using while loop).
int factorial(int n) { int x = 1; int i = 2; while (i <= n) { x *= i; i++; } return x; }
Sorry, my bad, mistake choosing loop)
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments
Leave a comment