Question: in c program please and thank you 3. Write two functions named factorial(), which computes the factorial of the number passed as an argument, and
in c program please and thank you
3. Write two functions named factorial(), which computes the factorial of the number passed as an argument, and prime(), which determines whether the number passed is a prime number or not. The functions are called from main() depending upon the user's choice determined by a variable called choice. If choice entered is 0, factorial of a number entered by the user is computed. If choice entered is 1, the same number is checked whether its a prime or not. If the factorial() is called, print the final result in main() and if prime() is called, print the result in the function itself. Factorial of a negative number is undefined. Make sure the user re-enters the number if a negative number is entered. Also, choice must be either 0 or 1. If anything other than those two choices are entered, ask the user to re-enter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
