Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int fact(int x) {
- if(x==1||x==0) return 1;
- else{
- return x * fact(x-1);
- }
- }
- long double power(long double x, int y) {
- long double u = 1;
- for(int i=0;i<y;i++) {
- u = u * x;
- }
- return u;
- }
- int main() {
- long double a = 4 * log(4);
- long double sum = 0;
- // cout << fact(5);
- // cout << power(2.5,4);
- long double fact = 1;
- for(int i = 0;i<50;i++) {
- fact = fact * (long double)(i+1);
- sum+= ((long double)(power(a,i) / (long double)fact));
- }
- cout << sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement