You are viewing a single comment's thread. Return to all comments →
You could, but not considered a good programming practice from the point of view of readability and avoiding strange bugs
Using loops without brackets when it using only 1 line is totally readable. If you push too much in one line, its not ok. Guys shoud have used ternary operator for real 1 line here. There is basically 2 lines
for (int i = 1; i <= n; i++)
if (n % i == 0)
sum += i;
This should be like this for 100% readability.