- 1
2 Answers
0
pow((-1), n) // not -1**n
edit:
#include <math.h>
#include <iostream>
using namespace std;
int main() {
double n;
double result = 0;
double rhs = M_PI / 4;
for(n=0; n < 10000000; n++){
result += pow((-1), n)/ (2 * n + 1);
if(result >= rhs || result<= 0)
break;
}
cout<<"Lhs = "<<result<<endl;
cout<<"Rhs = "<<rhs;
return 0;
}
0
Thx bro