Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- double pow (double a,double b) {
- double p = 1;
- if (b==0) return 1;
- for (int i = 0;i<b;i++) {
- p*=a;
- }
- return p;
- }
- double fact (int n) {
- if (n==0) return 1;
- int p = 1;
- for (int i = 1;i<=n;i++ ){
- p*=i;
- }
- return p;
- }
- double functio1 (double x,double e) {
- double sum = 0;
- double p = 1;
- int i = 1;
- while (p>=e) {
- p = pow(-1,i) * pow(x,(2*i-1)) / pow(2.718281828459045235360287471352662497757247093699959574966,i) / fact(i);
- sum+=p;
- i++;
- }
- return sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement