probably you get a 0, and that's not what you need you to get.
If you ask why, the thing is very simple, when two numbers in half,
which are defined as an integer, the computer assumes that you still need
integer solutions and takes only integer value, and it is evident
that every time i / j has to be less than 0
There are several ways to rijesis this issue, but essentially all boil down to
same thing. And that is that "you say" that you should get floast solution (or double).
And it is very easy to do: sum+=float(i)/j;
i can find the reason by one of my friends in the class...
when we define the i and j in type int
the answer of i/j will be int type too it means the output will be 0...
to calculate that expression we can do this: