A series with same common difference is known as arithmetic series. The first term of series is 'a' and common difference is d. The series looks like a, a + d, a + 2d, a + 3d, . . . Find the sum of series upto nth term.
Input: 5 1 3
Explanation: Series upto 5th term is
1 4 7 10 13, so sum will be 35.
Input: 3 1 2
Example: Series upto 3rd term is
1 3 5, so sum will be 9.
You don't need to read or print anything. Your task is to complete the function sum_of_ap() which takes n, a and d as input parameter and returns the sum of the series.
Expected Time Complexity: O(1) Expected Space Complexity: O(1)