Write a python function that would return the sum of first n natural numbers, where n is the input


Topic: Write a python function that would return the sum of first n natural numbers, where n is the input

Solution

def sum_first_n(n):
    return ( n * (n+1) ) // 2



List all Python Programs