answersLogoWhite

0

/*************************************************************************/

/* POISSON3.C */

/* Calculate poisson statistics given average number of occurences */

/* and the value of interest. */

/* Uses the formula P(X=x) = mu^x * e^-mu/x!, for x = 1,2,3...x */

/* NOTICE: Factorial1() is copyrighted by author */

/* FURTHERMORE: Software is provided as is, with no promise of fitness */

/* for use. */

/* comments or questions: p_duke52@Yahoo.com */

/* Have fun... */

/* PAD, May 25, 2008 */

/*************************************************************************/ #include <stdio.h>

#include <math.h> /* protype of "e", exp(x) == exp^x */

#include <conio.h> /* For clrscr() */ /*********************************************************\

// copyrighted by author

// Written by: Jaco van Staden

// Date: 13 July 2002

// Program: Maths Program

// from the file "A_maths_me1067647162002.zip"

// available at Planet Source Code:

// http://www.planet-source-code.com

// changed int to double for size issues

// -- PAD, 5/25/08

\**********************************************************/ 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; clrscr(); /* 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;

} /*************************************************************************/

/* POISSON3.C */

/* Calculate poisson statistics given average number of occurences */

/* and the value of interest. */

/* Uses the formula P(X=x) = mu^x * e^-mu/x!, for x = 1,2,3...x */

/* NOTICE: Factorial1() is copyrighted by author */

/* FURTHERMORE: Software is provided as is, with no promise of fitness */

/* for use. */

/* comments or questions: p_duke52@yahoo.com */

/* Have fun... */

/* PAD, May 25, 2008 */

/*************************************************************************/ #include <stdio.h>

#include <math.h> /* protype of "e", exp(x) == exp^x */

#include <conio.h> /* For clrscr() */ /*********************************************************\

// copyrighted by author

// Written by: Jaco van Staden

// Date: 13 July 2002

// Program: Maths Program

// from the file "A_maths_me1067647162002.zip"

// available at Planet Source Code:

// http://www.planet-source-code.com

// changed int to double for size issues

// -- PAD, 5/25/08

\**********************************************************/ 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; clrscr(); /* 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;

}

User Avatar

Wiki User

17y ago

What else can I help you with?

Related Questions

What are the key considerations when implementing a C program that simulates a Poisson distribution?

When implementing a C program to simulate a Poisson distribution, key considerations include understanding the Poisson distribution formula, generating random numbers using a Poisson distribution, and ensuring the program accurately reflects the expected distribution outcomes. Additionally, it is important to validate the results of the simulation and optimize the program for efficiency.


Getting source code of c?

C is a programming language, so it doesn't have source code.(On the other hand, C compilers do have source code, but you, as a beginner in programming, could not understand them.)


How do you Open a text file as C plus plus source code?

All C++ source code is is a text file with the .cpp extension. So if you save your code as *****.cpp then it is automatically C++ source code.


What is the source code for scientific calculator in c?

What is the source code for scientific calculator in c?Read more: What_is_the_source_code_for_scientific_calculator_in_c


Stack overflow Exception source code in c sharp?

You have to ask Microsoft for the source code


How do you convert .c extension to .exe?

To convert source code (.c file) to an executable (.exe) file you have to use a compiler, which is a translator of source code to machine code.


What is the differentiate of turbo c from turbo c plus plus?

Turbo C compiles c source. turbo c++ compiles c++ source code.


Where do you get the exact source code in C that implements lossless compression algorithm?

The source code, in C, will depend on what type of lossless compression algorithm will be used. A source code should be available from various computer scientists in your area.


What type of a program is used in order to enter c source code?

What type of a program is used in order to enter C source code


How do you convert c exe to source code?

Not possible.


What is a source code file in c plus plus?

A source code file is a plain-text file containing C++ instructions. The instructions must be compiled and linked to create a native machine code executable.


Source code of lotto game lottery in c?

sravanthi