# Sum of cubes of n even natural numbers

Here given code implementation process.

``````// C Program
// Sum of cubes of n even natural numbers
#include <stdio.h>

void findSunOfCube(int n)
{
if (n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
double sum = 2 *((n *(n + 1)) *(n *(n + 1)));
// Display calculated result
printf("\n %lf", sum);
}
int main()
{
int n = 3;
/*
n = 3
*/
findSunOfCube(n);
return 0;
}``````

#### Output

`` 288.000000``
``````// Java program for
// Sum of cubes of n even natural numbers
public class Sum
{
public void findSunOfCube(int n)
{
if (n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
double sum = 2 * ((n * (n + 1)) * (n * (n + 1)));
// Display calculated result
System.out.print("\n " + sum );
}
public static void main(String[] args)
{

int n = 3;
/*
n = 3
*/
}
}``````

#### Output

`` 288.0``
``````// Include header file
#include <iostream>

using namespace std;
// C++ program for
// Sum of cubes of n even natural numbers
class Sum
{
public: void findSunOfCube(int n)
{
if (n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
double sum = 2 *((n *(n + 1)) *(n *(n + 1)));
// Display calculated result
cout << "\n " << sum;
}
};
int main()
{
int n = 3;
/*
n = 3
*/
return 0;
}``````

#### Output

`` 288``
``````// Include namespace system
using System;
// Csharp program for
// Sum of cubes of n even natural numbers
public class Sum
{
public void findSunOfCube(int n)
{
if (n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
double sum = 2 * ((n * (n + 1)) * (n * (n + 1)));
// Display calculated result
Console.Write("\n " + sum);
}
public static void Main(String[] args)
{
int n = 3;
/*
n = 3
*/
}
}``````

#### Output

`` 288``
``````package main
import "fmt"
// Go program for
// Sum of cubes of n even natural numbers
type Sum struct {}
func getSum() * Sum {
var me *Sum = &Sum {}
return me
}
func(this Sum) findSunOfCube(n int) {
if n <= 0 {
return
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
sum := 2 * ((n * (n + 1)) * (n * (n + 1)))
// Display calculated result
fmt.Print("\n ", sum)
}
func main() {
var task * Sum = getSum()
var n int = 3
/*
n = 3
*/
}``````

#### Output

`` 288``
``````<?php
// Php program for
// Sum of cubes of n even natural numbers
class Sum
{
public	function findSunOfCube(\$n)
{
if (\$n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
\$sum = 2 * ((\$n * (\$n + 1)) * (\$n * (\$n + 1)));
// Display calculated result
echo("\n ".\$sum);
}
}

function main()
{
\$n = 3;
/*
n = 3
*/
}
main();``````

#### Output

`` 288``
``````// Node JS program for
// Sum of cubes of n even natural numbers
class Sum
{
findSunOfCube(n)
{
if (n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
var sum = 2 * ((n * (n + 1)) * (n * (n + 1)));
// Display calculated result
process.stdout.write("\n " + sum);
}
}

function main()
{
var n = 3;
/*
n = 3
*/
}
main();``````

#### Output

`` 288``
``````#  Python 3 program for
#  Sum of cubes of n even natural numbers
class Sum :
def findSunOfCube(self, n) :
if (n <= 0) :
return

#  Calculate sum of cube of n natural number
#  Formula : 2×(n×(n+1))²
sum = 2 * ((n * (n + 1)) * (n * (n + 1)))
#  Display calculated result
print("\n ", sum, end = "")

def main() :
n = 3
#    n = 3

if __name__ == "__main__": main()``````

#### Output

``  288``
``````#  Ruby program for
#  Sum of cubes of n even natural numbers
class Sum
def findSunOfCube(n)
if (n <= 0)
return
end

#  Calculate sum of cube of n natural number
#  Formula : 2×(n×(n+1))²
sum = 2 * ((n * (n + 1)) * (n * (n + 1)))
#  Display calculated result
print("\n ", sum)
end

end

def main()
n = 3
#    n = 3
end

main()``````

#### Output

`` 288``
``````// Scala program for
// Sum of cubes of n even natural numbers
class Sum()
{
def findSunOfCube(n: Int): Unit = {
if (n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
var sum: Double = 2 * ((n * (n + 1)) * (n * (n + 1)));
// Display calculated result
print("\n " + sum);
}
}
object Main
{
def main(args: Array[String]): Unit = {
var task: Sum = new Sum();
var n: Int = 3;
/*
n = 3
*/
}
}``````

#### Output

`` 288.0``
``````// Swift 4 program for
// Sum of cubes of n even natural numbers
class Sum
{
func findSunOfCube(_ n: Int)
{
if (n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
let sum: Int = 2 * ((n * (n + 1)) * (n * (n + 1)));
// Display calculated result
print("\n ", sum, terminator: "");
}
}
func main()
{
let n: Int = 3;
/*
n = 3
*/
}
main();``````

#### Output

``  288``
``````// Kotlin program for
// Sum of cubes of n even natural numbers
class Sum
{
fun findSunOfCube(n: Int): Unit
{
if (n <= 0)
{
return;
}
// Calculate sum of cube of n natural number
// Formula : 2×(n×(n+1))²
val sum = 2 * ((n * (n + 1)) * (n * (n + 1)));
// Display calculated result
print("\n " + sum);
}
}
fun main(args: Array < String > ): Unit
{
val n: Int = 3;
/*
n = 3
*/
}``````

#### Output

`` 288``

## Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.