Hello everyone, this should be an easy problem for anyone her I believe because I'm just not noticing why it won't display the answer. I'm trying to solve this book problem......
"Write a for loop that calculates the total of the follower series of numbers:
1/30 + 2/29 + 3/28......+30/1"
Here is what I have..
When launched, the output is 0.0. I tried changing the variables a and b to doubles but didn't change anything, any help? Thanks!public static void main(String[] args) {
double total = 0;
for (double a = 1, b = 30; b < 1; a++, b--) {
total += (a / b);
}
System.out.println(total);
}
}
P.s how do you post a code correctly on this forum?