84 553
Assignments Done
98,9%
Successfully Done
In March 2020

# Answer to Question #33669 in C++ for Ramesh Kumar

Question #33669
An insurance company has discovered that only about 0.1% of the population is involved ina certain type of accident each year. If its 10000 policy holders were randomly selected from the population, what is the probability that not more than 5 of its clients are involved in such an accident nest year.
1
Expert's answer
2013-08-06T08:43:36-0400
//We use Bernoulli trials http://en.wikipedia.org/wiki/Bernoulli_trial

#include <conio.h>
#include <iostream>

using namespace std;

double _pow(double base,int n )
{
double base2 = base;
if(n == 0)
return 1;
for(int i = 1 ;i < n ;i++)
base *=base2;
return base;
}

long double C(int k , int n)
{
long double top = 1,bottom =1;
for(int i = n; i > n-k; i--)
top *= i;
for(int i = 2 ;i < k; i++)
bottom *= i;
return long double (top/bottom);
}

void main()
{
int n = 10000;
double p = 0.001 , P = 0. ;
for(int k = 0 ; k <= 5; k++)
{
P += C(k, n ) * _pow (p , k) * _pow (1 - p , n - k);
}
cout<<"Probability = "<<P*100<<"%"<<endl;
_getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

#### Comments

No comments. Be first!

### Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS