Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- using namespace std;
- int main()
- {
- double p = 0.01;
- double q = 1-p;
- double r = 0;
- int n = 50;
- double d = 50*49/2;
- d *= p * p;
- for(int i = 0; i<48; i++) d*=q;
- r += d;
- d = 50;
- d*=p;
- for(int i = 0; i<49; i++) d*=q;
- r += d;
- d=1;
- for(int i = 0; i<50; i++) d*=q;
- r+=d;
- cout<<r;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement