# Dodecahedral number

Here given code implementation process.

// C Program for
// Dodecahedral number
#include <stdio.h>

void dodecahedralNo(int k)
{
// Print all initial k dodecahedral number
for (int n = 0; n < k; ++n)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
int result = (n *(3 *n - 1) *(3 *n - 2)) / 2;

// Display calculated result
printf("  %d", result);
}
}
int main()
{
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
dodecahedralNo(10);
return 0;
}

#### Output

0  1  20  84  220  455  816  1330  2024  2925
// Java program for
// Dodecahedral number
public class DodecahedralNumber
{
public void dodecahedralNo(int k)
{
// Print all initial k dodecahedral number
for (int n = 0; n < k; ++n)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
int result = (n * (3 * n - 1) * (3 * n - 2)) / 2;

// Display calculated result
System.out.print(" " + result);
}
}
public static void main(String[] args)
{
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
}
}

#### Output

0 1 20 84 220 455 816 1330 2024 2925
#include <iostream>
using namespace std;
// C++ program for
// Dodecahedral number

class DodecahedralNumber
{
public: void dodecahedralNo(int k)
{
// Print all initial k dodecahedral number
for (int n = 0; n < k; ++n)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
int result = (n *(3 *n - 1) *(3 *n - 2)) / 2;

// Display calculated result
cout << " " << result;
}
}
};
int main()
{
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc
// Test k = 10
return 0;
}

#### Output

0 1 20 84 220 455 816 1330 2024 2925
// Include namespace system
using System;
// Csharp program for
// Dodecahedral number
public class DodecahedralNumber
{
public void dodecahedralNo(int k)
{
// Print all initial k dodecahedral number
for (int n = 0; n < k; ++n)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
int result = (n * (3 * n - 1) * (3 * n - 2)) / 2;

// Display calculated result
Console.Write(" " + result);
}
}
public static void Main(String[] args)
{
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
}
}

#### Output

0 1 20 84 220 455 816 1330 2024 2925
package main
import "fmt"
// Go program for
// Dodecahedral number

func dodecahedralNo(k int) {
// Print all initial k dodecahedral number
for n := 0 ; n < k ; n++ {
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2
// Calculate nth dodecahedral number
var result int = (n * (3 * n - 1) *
(3 * n - 2)) / 2
// Display calculated result
fmt.Print(" ", result)
}
}
func main() {

// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
dodecahedralNo(10)
}

#### Output

0 1 20 84 220 455 816 1330 2024 2925
<?php
// Php program for
// Dodecahedral number
class DodecahedralNumber
{
public	function dodecahedralNo(\$k)
{
// Print all initial k dodecahedral number
for (\$n = 0; \$n < \$k; ++\$n)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
\$result = (int)((\$n * (3 * \$n - 1) * (3 * \$n - 2)) / 2);

// Display calculated result
echo(" ".\$result);
}
}
}

function main()
{
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
}
main();

#### Output

0 1 20 84 220 455 816 1330 2024 2925
// Node JS program for
// Dodecahedral number
class DodecahedralNumber
{
dodecahedralNo(k)
{
// Print all initial k dodecahedral number
for (var n = 0; n < k; ++n)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
var result = parseInt((n * (3 * n - 1) *
(3 * n - 2)) / 2);

// Display calculated result
process.stdout.write(" " + result);
}
}
}

function main()
{
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
}
main();

#### Output

0 1 20 84 220 455 816 1330 2024 2925
#  Python 3 program for
#  Dodecahedral number
class DodecahedralNumber :
def dodecahedralNo(self, k) :
n = 0
#  Print all initial k dodecahedral number
while (n < k) :
#  Formula
#   n(3n - 1) (3n - 2)
#   ————————————————————
#           2

#  Calculate nth dodecahedral number
result = int((n * (3 * n - 1) * (3 * n - 2)) / 2)

#  Display calculated result
print(" ", result, end = "")
n += 1

def main() :
#  Dodecahedral number are
#  —————————————————————————————————————————————
#   0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
#   4060, 5456, 7140, 9139, 11480, 14190, 17296,
#   20825, 24804, 29260, 34220, 39711, 45760, 52394,
#   59640, 67525, 76076, 85320, 95284, 105995,
#   117480, 129766, 142880, 156849 ... etc

#  Test k = 10

if __name__ == "__main__": main()

#### Output

0  1  20  84  220  455  816  1330  2024  2925
#  Ruby program for
#  Dodecahedral number
class DodecahedralNumber
def dodecahedralNo(k)
n = 0
#  Print all initial k dodecahedral number
while (n < k)
#  Formula
#   n(3n - 1) (3n - 2)
#   ————————————————————
#           2

#  Calculate nth dodecahedral number
result = (n * (3 * n - 1) * (3 * n - 2)) / 2

#  Display calculated result
print(" ", result)
n += 1
end
end
end

def main()
#  Dodecahedral number are
#  —————————————————————————————————————————————
#   0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
#   4060, 5456, 7140, 9139, 11480, 14190, 17296,
#   20825, 24804, 29260, 34220, 39711, 45760, 52394,
#   59640, 67525, 76076, 85320, 95284, 105995,
#   117480, 129766, 142880, 156849 ... etc

#  Test k = 10
end

main()

#### Output

0 1 20 84 220 455 816 1330 2024 2925
// Scala program for
// Dodecahedral number
class DodecahedralNumber()
{
def dodecahedralNo(k: Int): Unit = {
var n: Int = 0;
// Print all initial k dodecahedral number
while (n < k)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
var result: Int = (n * (3 * n - 1) *
(3 * n - 2)) / 2;

// Display calculated result
print(" " + result);
n += 1;
}
}
}
object Main
{
def main(args: Array[String]): Unit = {
var task: DodecahedralNumber = new DodecahedralNumber();
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
}
}

#### Output

0 1 20 84 220 455 816 1330 2024 2925
// Swift 4 program for
// Dodecahedral number
class DodecahedralNumber
{
func dodecahedralNo(_ k: Int)
{
var n: Int = 0;
// Print all initial k dodecahedral number
while (n < k)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
let result: Int = (n * (3 * n - 1) * (3 * n - 2)) / 2;

// Display calculated result
print(" ", result, terminator: "");
n += 1;
}
}
}
func main()
{
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
}
main();

#### Output

0  1  20  84  220  455  816  1330  2024  2925
// Kotlin program for
// Dodecahedral number
class DodecahedralNumber
{
fun dodecahedralNo(k: Int): Unit
{
var n: Int = 0;
// Print all initial k dodecahedral number
while (n < k)
{
// Formula
//  n(3n - 1) (3n - 2)
//  ————————————————————
//          2

// Calculate nth dodecahedral number
val result: Int = (n * (3 * n - 1) * (3 * n - 2)) / 2;

// Display calculated result
print(" " + result);
n += 1;
}
}
}
fun main(args: Array < String > ): Unit
{
// Dodecahedral number are
// —————————————————————————————————————————————
//  0, 1, 20, 84, 220, 455, 816, 1330, 2024, 2925,
//  4060, 5456, 7140, 9139, 11480, 14190, 17296,
//  20825, 24804, 29260, 34220, 39711, 45760, 52394,
//  59640, 67525, 76076, 85320, 95284, 105995,
//  117480, 129766, 142880, 156849 ... etc

// Test k = 10
}

#### Output

0 1 20 84 220 455 816 1330 2024 2925

## 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.