summaryrefslogtreecommitdiff
path: root/3544/CH2/EX2.51/Ex2_51.sce
blob: a4229ffd3e3b79dae9b1a818f670b33cdcbe9c27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

// Number of parties and the corresponding number of lock-and-key pairs

printf("Parties involved\tNumber of lock-and-key pairs required")

n = (2:5)

//disp(n)
num = factorial(n)
//disp(num)
den = factorial(2)*factorial(n-2)
//disp(den)

for i=1:length(num)
    printf("\n\t%d\t\t\t\t%d\n",n(i),num(i)/den(i))
end