Write a program with a for loop that calculates the sum of t
Write a program with a for loop that calculates the sum of the following in Java
sum = 1/25+2/24+3/23......+24/2+25/1
Solution
SumOfNumbers.java
public class SumOfNumbers {
   public static void main(String[] args) {
        double sum = 0;
        for(double i=1, j=25; i<=25; i++,j--){
            sum = sum + i/j;
        }
        System.out.println(\"Sum is \"+sum);
    }
}
Output:
Sum is 74.21491262159117

