Question: Sum the numbers from 1 to n Write a function sum _ n ( n ) that takes a positive integer n * * and

Sum the numbers from 1 to n
Write a function sum_n(n) that takes a positive integer n** and returns the sum of the numbers from 1 to n using the formula
S=n(n+1)2.
The return value should be an int, not a float .
Examples:
sum_n(3) returns 6.
 Sum the numbers from 1 to n Write a function sum_n(n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!