Cari Blog Ini

Program Binomial

Selasa, 24 Desember 2013
program binomial;
uses wincrt;
var
i,j,k,n,x:longint;
a,b,c,d,e,p: real;

begin
     readln (n);
     readln (x);
     readln (p);
     a:=1;b:=1;c:=1;d:=1;e:=1;
     for i:=1 to n do
     a:=a*i;
     for j:=1 to x do
     begin
     b:=b*j;
     c:=c*p;
     end;
     for k:=1 to (n-x) do
     begin
     d:=d*k;
     e:=e*(1-p);
     end;
     writeln (a/(b*d)*c*e:0:4);

end.

0 komentar:

Posting Komentar