Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make a method using three digits chopping

Status
Not open for further replies.

erashabani

Programmer
Jan 18, 2010
2
0
0
RS
hi, can anyone help me how to make a method using three digits chopping to sum a finite series in java? any idea of coding? example how to compute a finit serie 1+1/4+1/9+...+1/100 using three digitts chopping in java ...
 
You need to have basic knowledge in Java Programming to write such method.

For chopping the digits, you may use the substring method in Java.lang.String class.

For calculating the sum of 1+1/4+1/9+...+1/100, you may use java.math.BigDecimal class to minimize the lose in precision during calcuation.
 
thnx prosper i did the program i just use string and substring so i chopped the numbers thank you very much...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top