26th number vedio of Dynamic programming i,e friend pairing problem

not able to correctly do the code ,may be have some logical problem help me to fix

//friend’s paring problem

#include<bits/stdc++.h>
using namespace std;

int NoOfWays(int n,int dp[])
{
int ans;
//base case
dp[0]=0,dp[1]=1;
for(int i=2;i<=n;i++)
{
dp[i]=dp[i-1]+(i-1)*dp[i-2];

}

return dp[n];
}

int main()
{
int n;
int dp[100]={0};
cout<<“number of friends:”<<endl;
cin>>n;
cout<<“no of way:”<<NoOfWays(n,dp);
return 0;
}

Please share the question link

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.