Write a C++ program to compute the nCr In permutations and combinations, the term nCr refers to n combinations taken r at a time. n! nCr = r! (n – r)!

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 12E: (Program) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question
Write a C++ program to compute the nCr
In permutations and combinations, the term nCr refers to n combinations taken r at a time.
n!
nCr =
r! (n – r)!
.Write a recursive function to find the factorial of a number.
.Use the defined function to compute the term nCr for the following scenario:
•The values of "n" and "r" are stored in two parallel arrays of any user defined size.
• You have to Read the arrays n and r at run time. Compute nCr for each corresponding terms in the array "n" and "r",
store it in another separate array and display the output array properly formatted.
• Also your program should print the current date and time using library functions.
Sample input:
Index
Array 'n'
22
13
4.
Array T
3
Computed nCr
1540
1287
1
2
2.
6.
3
16
560
100947
18564
23
18
15
18
22
6.
6.
7
8
9.
4.
1364
816
26334
5.
Transcribed Image Text:Write a C++ program to compute the nCr In permutations and combinations, the term nCr refers to n combinations taken r at a time. n! nCr = r! (n – r)! .Write a recursive function to find the factorial of a number. .Use the defined function to compute the term nCr for the following scenario: •The values of "n" and "r" are stored in two parallel arrays of any user defined size. • You have to Read the arrays n and r at run time. Compute nCr for each corresponding terms in the array "n" and "r", store it in another separate array and display the output array properly formatted. • Also your program should print the current date and time using library functions. Sample input: Index Array 'n' 22 13 4. Array T 3 Computed nCr 1540 1287 1 2 2. 6. 3 16 560 100947 18564 23 18 15 18 22 6. 6. 7 8 9. 4. 1364 816 26334 5.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning