We would like to write a program to sum the following series:
1/3 + 3/5 + 5/7 + 7/9 + 9/11 + 11/13 + ... + 95/97 + 97/99
public class Main { public static void main(String[] args) { double sum = 0.0; //your code here System.out.println(sum); } }
public class Main { public static void main(String[] args) { double sum = 0.0; for (int i = 1; i <= 97; i += 2) { sum += (double)i / (double)(i + 2); } System.out.println(sum); } }