# Find sum of the series ?3 + ?12 +……… upto N terms

• Last Updated : 25 Mar, 2021

Given a number n, the task is to find the sum of first n terms of this series. Below is the series: Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a student-friendly price. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

Examples:

Input: n = 10
Output: 95.2628

Input: n = 5
Output: 25.9808

This series can be seen as- Below is the required implementation:

## C++

 // C++ implementation of above approach#include #define ll long long intusing namespace std; // Function to find the sumdouble findSum(ll n){     // Apply AP formula    return sqrt(3) * (n * (n + 1) / 2);}// Driver codeint main(){    // number of terms    ll n = 10;     cout << findSum(n) << endl;    return 0;}

## Java

 // Java implementation of// above approachimport java.io.*; class GFG{ // Function to find the sumstatic double findSum(long n){    // Apply AP formula    return Math.sqrt(3) * (n *                    (n + 1) / 2);}// Driver codepublic static void main (String[] args){    // number of terms    long n = 10;         System.out.println( findSum(n));}} // This code is contributed// by inder_verma..

## Python3

 # Python3 implementation of above approach #Function to find the sumimport mathdef findSum(n):    # Apply AP formula    return math.sqrt(3) * (n * (n + 1) / 2) # Driver code# number of termsif __name__=='__main__':    n = 10    print(findSum(n)) # This code is contributed by sahilshelangia

## C#

 // C# implementation of// above approachusing System; class GFG{ // Function to find the sumstatic double findSum(long n){    // Apply AP formula    return Math.Sqrt(3) * (n *                    (n + 1) / 2);}// Driver codepublic static void Main (){    // number of terms    long n = 10;         Console.WriteLine( findSum(n));}} // This code is contributed// by inder_verma..

## PHP

 

## Javascript

 
Output:
95.2628

My Personal Notes arrow_drop_up