Hello I'm a beginner in Java and I have a question regarding summing the iterations. The question is: Write a program that computes the following expression to 4 decimal places: (1/10) + (2/9) + (3/8) + (4/7) + (5/6) + (6/5) + (7/4) + (8/3) + (9/2) + (10/1)
So far I have:
public class Expression
{
public static void main(String[] args)
{
float x;
for ( float m=1, n=10; m<11; m++,n--)
{
x = (m)/(n);
}
How would I go about summing all the iterations the for loop makes?
Thanks everyone :)