The combinations function C(n, k) is usually defined in terms of factorials,
as follows:
C(n, k) = n!/(k!*(n-k)!)
The values of C(n, k) also leads to the Pascal Triangle:
C(0, 0)
C(1, 0) C(1, 1)
C(2, 0) C(2, 1) C(2, 2)
C(3, 0) C(3, 1) C(3, 2) C(3, 3)
C(4, 0) C(4, 1) C(4, 2) C(4, 3) C(4, 4)

Use this fact to write a recursive implementation of the C(n, k) function that uses no loops, and no multiplication. Write a simple program that shows your combinations function works. Also, write a program that uses C(n, k) to display the first ten rows of Pascal’s Triangle.

HElP PLEASE! YOU CAN USE <iostream>.

We don't do homework, forum rules - read them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.