+ 1
A program to illustrate the use of functions to add all numbers from 1 to 100
using a non-recursive and recursive function
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