0
What does this step mean s=s+(double)i/(i+1)
need fast answer as soon as possible
3 Antworten
+ 12
Please provide with code & other information like datatype of variable s & i (though looks like variable of i is of type int (not double type), data type of s can create a difference in answer) to get better help from community.
//can also be written as "s+=(double)i/(i+1)"
+ 2
When performing a division, if both operands are integers, the euclidian division will be used. To prevent that, you need to cast at least one of the operands into a float or double, which is done here.