+ 1

A program to illustrate the use of functions to add all numbers from 1 to 100

using a non-recursive and recursive function

29th May 2017, 9:57 AM
chamaliakhan
1 Answer
+ 2
@Luka Ivanovic I like your usage of loops, and that totally works, but there is a mathematical way to get the same answer without loops or recursion. For this reason, the code will run much faster, especially for larger numbers. Here is my implementation of what I'm talking about: https://code.sololearn.com/cn41rm8kLJl9
29th May 2017, 5:49 PM
Zeke Williams
Zeke Williams - avatar