blob: 0e73ebb246d5827db67d6ecc22bdccc75b031bba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
//Chapter 07: Discrete Probability
clc;
clear;
total_balls=50 //total no of balls in bin
pr=1
//Part-(A) Sampling without replacement
given_no=5 //11 4 17 39 23
select_ways=1 //ways in which that particular order can be drawn
n=total_balls-given_no
for i=total_balls:-1:n+1
pr=pr*i
end
prob=select_ways/pr
disp(prob,'The probability that 11,4,17,39,23 are drawn in that order is')
//Part-(B) Sampling with replacement
total_ways=total_balls**given_no //5 is the no.of balls ,i.e, 11 4 17 39 23
select_ways=1 //numbers are drawn in that order
prob=select_ways/total_ways
disp(prob,'The probability that 11,4,17,39,23 are drawn in that order is')
|