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);
- }
- }
- float power(float x, int y) {
- float u = 1;
- for(int i=0;i<y;i++) {
- u = u * x;
- }
- return u;
- }
- int main() {
- float a = 5.5 * log(4);
- float sum = 0;
- // cout << fact(5);
- // cout << power(2.5,4);
- int fact = 1;
- for(int i = 0;i<16;i++) {
- fact = fact * (i+1);
- sum+= ((float)(power(a,i) / (float)fact));
- }
- cout << sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement