### Binomial Coefficient for multiple numbers

I need some help with my homework, it is really important. I need to make outputs of binomial coefficients in range from 2 to 10. Now, I've managed to make a formula for giving me those numbers, and other formulas for incrementation and binomial coefficient also. I only need to put them together. Can someone rewrite the code for me. I'm really new to this codding stuff.

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960`` `````` #include using namespace std; int calcalting () { int n=2; int r=0; do{ if(n==r){ n++; r=r*=0;} if (n<=10) { cout<<"n is " << n << endl << endl; } if (r!=n){ r++;} if (r<=n) { cout << "r is " << r << endl << endl << endl ; } }while(n<10 || r<10); } int factorial_a(int n) { if (n==1){ return 1;} else{ return n*factorial_a(n-1); } } int factorial_b(int r) { if (r==1){ return 1; } else { return r*factorial_b(r-1); } } int factorial_c(int n - int r) { if (n-r==1){ return 1; } else { return (n-r)*factorial_c((n-r)-1); } } } int main () { int binomial_coefficient= factorial_a/(factorial_c * factorial_b) cout << binomial is << binomial_coefficient; return 0; } ``````

The final result in one of the lines should be something like this:

n is 7
binomial is 20
r is 4
Topic archived. No new replies allowed.