Results 1 to 5 of 5
 10022011, 05:38 AM #1Member
 Join Date
 Oct 2010
 Posts
 38
 Rep Power
 0
Summing a Series: Is this correct??
Write a program to sum the following series:
(1/3) + (3/5) + (5/7) + (7/9) + (9/11) + (11/13) + ... + (95/97) + (97/99)
This is my attempt.
Java Code:public class SummingSeries { public static void main(String[] args) { double sum = 0.0; for(double i = 1; i <= 99; i++) { sum += ((i+2)/(i+4)); } System.out.println("The sum is " + sum); } }
The sum is 92.73308433232398
 10022011, 06:48 AM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,188
 Blog Entries
 7
 Rep Power
 24
 10022011, 08:09 PM #3Member
 Join Date
 Oct 2010
 Posts
 38
 Rep Power
 0
Re: Summing a Series: Is this correct??
I see my mistake now thanks. I fixed my code.
Java Code:public class SummingSeries { public static void main(String[] args) { double sum = 0.0; for(double i = 1; i <= 49; i++) { sum += ((2*i1)/(2*i+1)); } System.out.println("The sum is " + sum); } }
 10022011, 08:36 PM #4
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,188
 Blog Entries
 7
 Rep Power
 24
 10052011, 05:36 PM #5Member
 Join Date
 Oct 2010
 Posts
 38
 Rep Power
 0
Similar Threads

Summing the digit
By gozuhair in forum New To JavaReplies: 13Last Post: 07182011, 07:09 AM 
summing value within Hashtable
By dc0m in forum New To JavaReplies: 4Last Post: 09232010, 12:17 AM 
Perrin series
By moamen in forum New To JavaReplies: 6Last Post: 12042009, 06:27 PM 
Help with summing series
By xplsivo in forum New To JavaReplies: 8Last Post: 11232009, 08:37 PM 
How to add a second series in jfreechart
By Manfizy in forum New To JavaReplies: 1Last Post: 03232009, 12:16 PM
Bookmarks