Comment Comment by revskill Well, how to calculate sum from 1 to 5000 ?Instead of looping from 1 to 5000, you define the relationship instead:sum(1,n) = 1 + n + sum(2, n-1).Isn't this clearer to understand problem first, instead of just looping ? parent revskill 3 years ago
Instead of looping from 1 to 5000, you define the relationship instead:
sum(1,n) = 1 + n + sum(2, n-1).
Isn't this clearer to understand problem first, instead of just looping ?