summaryrefslogtreecommitdiff
path: root/3808/CH6/EX6.7/Ex6_7.sce
blob: d1b2a36c28f3e89bd562fbb2be86c0cd9388c071 (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 //computing the permutation
res=res*i
end
return res
endfunction

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