2- The factorial n! of a positive integer n is defined as n! = 1*2*3 . .. * (n-1) * n Where 0! = 1 Write a function to calculate the factorial of a number. Argument: A number n of type unsigned int....


2- The factorial n! of a positive integer n is defined as<br>n!<br>= 1*2*3 . .. * (n-1) * n Where 0!<br>= 1<br>Write a function to calculate the factorial of a number.<br>Argument: A number n of type unsigned int.<br>Returns: The factorial n! of type long double.<br>Write two versions of the function, where the factorial is<br>• calculated using a loop<br>calculated recursively<br>Test both functions by outputting the factorials of the numbers 0 to 20.<br>

Extracted text: 2- The factorial n! of a positive integer n is defined as n! = 1*2*3 . .. * (n-1) * n Where 0! = 1 Write a function to calculate the factorial of a number. Argument: A number n of type unsigned int. Returns: The factorial n! of type long double. Write two versions of the function, where the factorial is • calculated using a loop calculated recursively Test both functions by outputting the factorials of the numbers 0 to 20.

Jun 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here