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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

#include<iostream>
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.