From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 3808/CH6/EX6.7/Ex6_7.sce | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 3808/CH6/EX6.7/Ex6_7.sce (limited to '3808/CH6/EX6.7') diff --git a/3808/CH6/EX6.7/Ex6_7.sce b/3808/CH6/EX6.7/Ex6_7.sce new file mode 100644 index 000000000..d1b2a36c2 --- /dev/null +++ b/3808/CH6/EX6.7/Ex6_7.sce @@ -0,0 +1,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) -- cgit