Question: Write a program lab 2 Problem 2 . c to calculate the permutation and combination for given n and r . The values of

Write a program "lab2Problem2.c" to calculate the permutation and combination for
given n and r. The values of n and r should be passed to the program as a command-
line argument. The permutation and combination are defined for given n and r as:
P(n,r)=n!(n-r)!,C(n,r)=P(n,r)r!
Output Format:
P(5,3)=60
C(5,3)=10
Requirement:
The program should take 2 command-line arguments. First argument
should be the value of n and the second argument should be the value of r.
First create a factorial function. Then, you can use the factorial function in
the functions to compute permutation and combination.
The result should be printed in the main function.
Sample Run:
(base) jovyanejupyter-asainju: /3240/1ab2$ gcc 1ab2Problem2,c -o 1ab2Problem2
ab2$./1ab2Problem253
P(5,3)=60
c(5,3)=10
ab2$./1ab2Problem2205
P(20,5)=1860480
c(20,5)=15504
 Write a program "lab2Problem2.c" to calculate the permutation and combination for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!