summaryrefslogtreecommitdiff
path: root/3808/CH6/EX6.8/Ex6_8.sce
blob: f3d23d608c58438b5d7691402950b33b610b79e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//Chapter 06: Counting

clc;
clear;

function res=permutation(n,r) //function definition
i=n
res=1
l=(n-r)+1
u=n
for i=l:u 
res=res*i
end
return res
endfunction

num=input("Enter the number of runners:")
perm=input("Enter the number of prizes:")
result=permutation(num,perm)
mprintf("The number of ways to decide the prize winners is %d ",result)