Question: Write a C program to calculate combination and permutation of the inputted numbers using the formulas given below Formulas ni n! C(n, r) P(n,r)- rl(n

Write a C program to calculate combination and permutation of the inputted numbers using the formulas given below Formulas ni n! C(n, r) P(n,r)- rl(n - r)! There are two functions in the program: Fact0 and Calc0. Fact funtion should receive a single integer value as a parameter to calculate its factorial and return the result. CalcQ function is a void function that receives N and R values as parameters and returns both of combination and parameters also. To calculate the combination and the permutation Calc0 function will need to make multiple FactO function calls The main program should input the N and R values from user and display the resulting combination and permutation values. The main should also continue receiving N and R values and calculate the combination and permutation as long as positive N and R values are inputted by the user. Remember that N value should be greater than R value to calculate combination and permutation. Your program should respond accordingly Look below the sample run and make sure your program works the same way. permutation results as Sample Run: Enter N value: 6 Enter R value: 4 Combination: C(6,4) 15.00 Permutation P (6,4) 360.06e Enter N value: 8 Enter R value: 2 Combination: C(8,2)28.00 Permutation P (8,2) -56.00 Enter N value: 3 Enter R value: 5 N value should be greater than R valueTry again. Enter N value:7 Enter R value: -2 Error Nor Rvalue should be equal or greater than zero. Bye
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
