2 ms·
The way you add the integers up to n is n(n+1)/2. Fixed that for you. No loops, and it's exact. Pick a better example.
by dreamcompiler 5y ago
The way you add the integers up to n is
n(n+1)/2.
Fixed that for you. No loops, and it's exact. Pick a better example.