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; }
20th Mar 2022, 8:59 PM
Jayakrishna 🇼🇳
0
Thx bro
20th Mar 2022, 9:00 PM
Daniel Alexis