diff --git a/Hackerrank + Geeks for Geeks + DS Courseware/10 days of statistics Hackerrank/geometric distribution 2.cpp b/Hackerrank + Geeks for Geeks + DS Courseware/10 days of statistics Hackerrank/geometric distribution 2.cpp new file mode 100644 index 0000000..21fd700 --- /dev/null +++ b/Hackerrank + Geeks for Geeks + DS Courseware/10 days of statistics Hackerrank/geometric distribution 2.cpp @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include +#include +using namespace std; + + +int main() { + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + float n,d; + cin>>n>>d; + int t; + cin>>t; + double p=(n*1.000)/(d*1.0000); + + double q=1-p; + double g=0.000; + for(int i=1;i +#include +#include +#include +#include +#include +using namespace std; + + +int main() { + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + float n,d; + cin>>n>>d; + int t; + cin>>t; + double p=(n*1.000)/(d*1.0000); + + double q=1-p; + double g=pow(q,t-1)*p; + + cout << fixed < +#include +#include +#include +#include +#include +using namespace std; + +//least square regression +int main() { + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + double x,y; + double sumx=0.00,sumy=0.00; + double sq_sumx=0.00,sq_sumy=0.00,sum_xy=0.00; + + for(int i=0;i<5;++i) + { cin>>x>>y; + sumx=sumx+x; + sumy=sumy+y; + sq_sumx=sq_sumx+pow(x,2); + sum_xy=sum_xy+x*y; + } + double meanx=sumx/5; + double meany=sumx/5; + + double b=(5*sum_xy-(sumx*sumy))/(5*sq_sumx-pow(sumx,2)); + double a=meany-b*meanx; + double Y=a+(b*80)-1; + cout< +#include +#include +#include +#include +using namespace std; + + +int main() { + int n; + cin>>n; + int ar[n]; + float s=0.0; + for(int i=0;i>ar[i]; + for(int i=0;imc) + { + mc=c; + mode=ar[i]; + } + } + cout< +#include +#include +#include +#include +#include +using namespace std; + + +int main() +{ + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + double mean,sd; + cin>>mean>>sd; + double q1; + cin>>q1; + double q2l,q2u; + cin>>q2l>>q2u; + double N1=0.000; + + for(double x=19.5;x>=0;--x) + { + N1=N1+pow(2*2.506*pow(2.718,pow(x-20,2)/8),-1); + } + cout< +#include +#include +#include +#include +#include +using namespace std; + + +int main() { + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + double mean; + cin>>mean; + int k; + cin>>k; + long long int k_f=1; + for(long long int i=1;i<=k;++i) + k_f=(k_f*i); + double pd=(pow(mean,k)*pow(2.71828,-(mean)))/k_f; + cout< +#include +#include +#include +#include +#include +using namespace std; + + +int main() { + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + double X,Y; + cin>>X>>Y; + + double Ca=160+40*(X+pow(X,2)); + + double Cb=128+40*(Y+pow(Y,2)); + cout< +#include +#include +#include +#include +using namespace std; + + +int main() { + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + int n; + cin>>n; + int ar[n]; + for(int i=0;i>ar[i]; + sort(ar,ar+n); + int q1,q2,q3,index,c=0,d=0; + if(n%2!=0) + { + index=n/2; + q2=ar[index]; + for(int i=0;i +#include +#include +#include +#include +using namespace std; + + +int main() { + /* Enter your code here. Read input from STDIN. Print output to STDOUT */ + int n; + cin>>n; + int x[n],w[n]; + for(int i=0;i>x[i]; + for(int i=0;i>w[i]; + float product=0.0; + float sum_w=0.0; + for(int i=0;i