Sum of 1 to n
Lesson 4 of 20 in Coddy's Beginner Challenges - Practice Basic Concepts course.
Challenge
EasyWrite a function named sum that gets a number n and returns the sum of the numbers from 1 to n.
Bonus - Make it a recursive function!
Try it yourself
int sum(int n) {
// Write code here
}