In this example, you will learn to calculate the sum of first n natural numbers. Mathematically, the sum of n natural numbers can be calculated by sum = n(n+1)/2