*5.24 (Sum a series) Write a program to sum the following series:
13+35+57+79+911+1113+...+9799
public class ProgrammingEx5_24 { public static void main(String[] args) { double sum = 0; for (int i = 1; i <= 97; i += 2) { sum += i / (i + 2.0); } System.out.println("Sum of the series is:" + sum); } }
No comments:
Post a Comment