anonymous
  • anonymous
#include #include #include float fact(int x); void main() { int n,x,m,a; float pmf,mean,var,p,q,ncr; printf("\t\t**********poisson Distribution***************\n"); scanf("%d",&x); printf("\nEnter value for alpha: "); scanf("%d",&a); pmf=(exp(-a)*pow(a,x))/fact(x); mean=a; var=a; printf("\n\nMean: %f\nVariancd: %f\npmf:%f",mean,var,pmf); getch(); } float fact(int f) { int i; float s=1.0; for(i=f;i>0;i--) { s=s*1; } return s; } help me friends its urgent i cant find satisfying output
Computer Science
jamiebookeater
  • jamiebookeater
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

nick67
  • nick67
hi thangeram, what's the purpose of fact function ?
anonymous
  • anonymous
to check condition that ans must be below 1 and to calulate pmf
nick67
  • nick67
as I can see that function (fact) always returns a value of 1.0

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
hmm your correct but nick tell me why it is not giving satisfying output
nick67
  • nick67
I don't know what the "fact" function should do on its input f
anonymous
  • anonymous
i am showing you another example
anonymous
  • anonymous
#include #include /* protype of "e", exp(x) == exp^x */ #include /* For clrscr() */ double Factorial1 (double a) { double answer = 1.0; while(a>1) answer *= a--; return answer; } int main(void) { double result, res1, res2; double i = 0.0, k = 0.00; double answer = 0.0; result = res1 = res2 = 0.0; /* makes it easier to see input prompts */ printf("Enter mean: "); scanf("%lf", &i); printf("Enter value of interest: "); scanf("%lf", &k); /* factorial of value of interest */ answer = Factorial1(k); /* formula for k */ result = pow(i,k); res1 = 1/(exp(k)); res2 = (result * res1) / answer; printf("answer is ... : %0.20lf", res2); return 0; }
nick67
  • nick67
may be it should evaluate the factorial value of f ? (f * f-1 * f-2 *...*1)
nick67
  • nick67
in that case you should have: float fact(int f) { float s=1.0; while(f>0) { s=s*f; f--; } return s; }
anonymous
  • anonymous
thanx nick
nick67
  • nick67
you're welcome :-)

Looking for something else?

Not the answer you are looking for? Search for more explanations.