+ 1
Please calculate the sum of:
1+(2/1)+(3/2)+(4/3)+(5/4)+...+(10/9) with any loops.
4 ответов
+ 3
int n = 10;
double sum = 0.0;
for(int i=1;i<=n;i++){
sum += i / Math.max(1, i-1);
}
+ 2
Sorry, I misunderstood your question.
0
Yes, I was trying. I know it is possible with for loop. First you have find out relation between loop variable and the expression. Here I was stoped.
0
Kevin, please try with loop.