- 1
20th Mar 2022, 12:21 PM
Julmiste Fils Noel
Julmiste Fils Noel - avatar
3 Antworten
+ 1
Why you are taking from 1 to 0.010 reverse ? I don't understand it.. But may you trying this.. hope it helps to get that.. #include <math.h> #include <iostream> using namespace std; int main() { double n; double result = 0; double rhs = 0.5 - M_PI / 8; for( n=1; n < 10000000; n++){ result += 1.0 / ((4 * n - 1) * (4 * n + 1)); if(result >= rhs || result<= 0) break; } cout<<"Lhs = "<<result<<endl; cout<<"Rhs = "<<rhs; return 0; } edit: Noël Julmiste Fils // there it have difference in a fraction point. //after reaching almost to (1/2 - PI/8) , it going to negetive values so it not equaling exactly but reaching to very very close to rhs.
20th Mar 2022, 12:42 PM
Jayakrishna 🇮🇳
20th Mar 2022, 7:44 PM
Julmiste Fils Noel
Julmiste Fils Noel - avatar
20th Mar 2022, 12:21 PM
Julmiste Fils Noel
Julmiste Fils Noel - avatar