Permutation and combination of 2 numbers

The following program calculates the permutation and combination of 2 numbers.

#include <iostream>
using namespace std;

int fact(int val) {
    if (val == 0 || val == 1)
        return 1;
    else
        return val * fact(val - 1);
}

int main() {
    int n, r, combination, permutation;

    cout << "Enter value of n : ";
    cin >> n;
    cout << "Enter value of r : ";
    cin >> r;

    combination = fact(n) / (fact(r) * fact(n - r));
    permutation = fact(n) / fact(n - r);

    cout << "\nCombination : " << combination << endl;
    cout << "Permutation : " << permutation;

    return 0;
}
Output
Enter value of n : 9
Enter value of r : 6

Combination : 84
Permutation : 60480