Click here to Skip to main content
14,576,820 members
Rate this:
Please Sign up or sign in to vote.
See more:
8C3= 56 and 8C2 =28
fibo(c(8,3))= c(8,3)+c(8,2)=56+28=84
9!=9*8*7*6...*1= 362880
8!= 8*7*6*5..*1=40320
fibo(fact(9))=9!+8!=403200

What I have tried:

#include<iostream>
using namespace std;
 
int binomialCoefficient(int n, int k)
{
    int dp[n+1][k+1];
 
    int i,j;
 
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=i && j<=k;j++)
        {
            if(j==0 || j==i)
                dp[i][j]=1;
 
            else
                dp[i][j]=dp[i-1][j-1]+dp[i-1][j];
        }
    }
 
    return dp[n][k];
}
 
int main()
{
    int n, k;
    cout<<"Enter the total number of objects "<<endl;
 cin="">>n;
 
    cout<<"Enter how many elements to be chosen out of "<<n<<" objects="" "<<endl;
="" cin="">>k;
 
    if(n<0 ||k<0 || k>n)
        cout<<"Invalid input";
 
    else
    {
        cout<<"The number of ways in which selections can be made is "<
Posted
Updated 30-Jun-20 9:28am
v5
Comments
0x01AA 30-Jun-20 14:02pm
   
On what date does it have to be delivered?
Member 14867507 30-Jun-20 14:10pm
   
as soon as possible
Suvendu Shekhar Giri 30-Jun-20 14:05pm
   
You forgot to add the question. Please use the "Improve question" widget below your question and update it with details about your issue.
Patrice T 30-Jun-20 14:33pm
   
Use Improve question to update your question.
So that everyone can pay attention to this information.
Member 14867507 30-Jun-20 14:36pm
   
please check it now
Rick York 5 days ago
   
Currently, the code as posted does not call the function you have written.
Rick York 30-Jun-20 15:11pm
   
OK, what is your question about this?
Richard MacCutchan 30-Jun-20 15:41pm
   
There is a lot of your code missing.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100