Monday, October 17, 2011

Application of Poisson Distribution




#include
#include
#include

long fact(int n)
{

if(n<=0)
return 1;

else
return n*fact(n-1);

}

double poisson(int x, double a)
{

if(x<0)
return 0;

else
{
return (exp(-a)*pow(a,x))/fact(x) ;
}
}

int main()
{

int x;
double mean;
clrscr();



printf("enter d value of x & mean: ");
scanf(" %d %lf",&x, &mean);

printf(" p(%d) = %f",x,poisson(x,mean));

getch();
return 0;
}



by Amrender

No comments:

Post a Comment