You are on page 1of 1

#include <iostream>

using namespace std;

int n;

float Pr;

void Produs(int k,int p,float &Pr)

float Pr1,Pr2;

if(k==p) Pr=(float)1/(1+2*k);

else{

Produs(k,(k+p)/2,Pr1);

Produs((k+p)/2+1,p,Pr2);

Pr=Pr1*Pr2;

int main()

cout << "n=" ;

cin>>n;

Produs(1,n,Pr);cout<<"Pr="<<Pr;

return 0;

You might also like