Site hosted by Angelfire.com: Build your free website today!

Program # 12 


C++

Dzwonkiewicz

 

Calculate the finite sum…using a for…loop.

 

1/1^2 + ½^2 + 1/3^2 + ¼^2 + … + 1/n^2

 

Use n = 100.

 

After he loop is done, multiply your result by 6 and take the square root.

 

What number is this?

 

Hint: use a break in your for…loop for where you exit the loop it your result gets lower than .000001 (in your VAR have this set as a const double epsilon = .000001)…………

 If (x<epsilon) break;  //jumps the loop, but continues the program.

 

 

 

“Beware Romeo, the Romans will leap from ditches to slash your tires” – Phil

 

 

visit http://www.alexchiu.com and be amused.

 

 

br-ASSHAMMA!” – Matt, Chris, Ryan