Pentatope number
Here given code implementation process.
// C Program for
// Pentatope number
#include <stdio.h>
void pentatopeNo(int k)
{
// Print all initial k pentatope number
for (int n = 1; n <= k; ++n)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
int result = n *(n + 1) *(n + 2) *(n + 3) / 24;
// Display calculated result
printf(" %d", result);
}
}
int main()
{
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
pentatopeNo(10);
return 0;
}
Output
1 5 15 35 70 126 210 330 495 715
// Java program for
// Pentatope number
public class PentatopeNumber
{
public void pentatopeNo(int k)
{
// Print all initial k pentatope number
for (int n = 1; n <= k; ++n)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
int result = n * (n + 1) * (n + 2) * (n + 3) / 24;
// Display calculated result
System.out.print(" " + result);
}
}
public static void main(String[] args)
{
PentatopeNumber task = new PentatopeNumber();
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
task.pentatopeNo(10);
}
}
Output
1 5 15 35 70 126 210 330 495 715
// Include header file
#include <iostream>
using namespace std;
// C++ program for
// Pentatope number
class PentatopeNumber
{
public: void pentatopeNo(int k)
{
// Print all initial k pentatope number
for (int n = 1; n <= k; ++n)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
int result = n *(n + 1) *(n + 2) *(n + 3) / 24;
// Display calculated result
cout << " " << result;
}
}
};
int main()
{
PentatopeNumber *task = new PentatopeNumber();
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
task->pentatopeNo(10);
return 0;
}
Output
1 5 15 35 70 126 210 330 495 715
// Include namespace system
using System;
// Csharp program for
// Pentatope number
public class PentatopeNumber
{
public void pentatopeNo(int k)
{
// Print all initial k pentatope number
for (int n = 1; n <= k; ++n)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
int result = n * (n + 1) * (n + 2) * (n + 3) / 24;
// Display calculated result
Console.Write(" " + result);
}
}
public static void Main(String[] args)
{
PentatopeNumber task = new PentatopeNumber();
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
task.pentatopeNo(10);
}
}
Output
1 5 15 35 70 126 210 330 495 715
package main
import "fmt"
// Go program for
// Pentatope number
func pentatopeNo(k int) {
// Print all initial k pentatope number
for n := 1 ; n <= k ; n++ {
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
var result int = n * (n + 1) *
(n + 2) * (n + 3) / 24
// Display calculated result
fmt.Print(" ", result)
}
}
func main() {
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
pentatopeNo(10)
}
Output
1 5 15 35 70 126 210 330 495 715
<?php
// Php program for
// Pentatope number
class PentatopeNumber
{
public function pentatopeNo($k)
{
// Print all initial k pentatope number
for ($n = 1; $n <= $k; ++$n)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
$result = (int)($n * ($n + 1) *
($n + 2) * ($n + 3) / 24);
// Display calculated result
echo(" ".$result);
}
}
}
function main()
{
$task = new PentatopeNumber();
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
$task->pentatopeNo(10);
}
main();
Output
1 5 15 35 70 126 210 330 495 715
// Node JS program for
// Pentatope number
class PentatopeNumber
{
pentatopeNo(k)
{
// Print all initial k pentatope number
for (var n = 1; n <= k; ++n)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
var result = parseInt(n * (n + 1) *
(n + 2) * (n + 3) / 24);
// Display calculated result
process.stdout.write(" " + result);
}
}
}
function main()
{
var task = new PentatopeNumber();
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
task.pentatopeNo(10);
}
main();
Output
1 5 15 35 70 126 210 330 495 715
# Python 3 program for
# Pentatope number
class PentatopeNumber :
def pentatopeNo(self, k) :
n = 1
# Print all initial k pentatope number
while (n <= k) :
# Formula
# (n (n + 1) (n + 2) (n + 3)) / 24
# Calculate nth pentatope number
result = int(n * (n + 1) *
(n + 2) * (n + 3) / 24)
# Display calculated result
print(" ", result, end = "")
n += 1
def main() :
task = PentatopeNumber()
# Pentatope number are
# —————————————————————————————————————————————
# 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
# 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
# 8855, 10626, 12650, 14950, 17550, 20475, 23751,
# 27405, 31465, 35960, 40920, 46376, 52360,
# 58905, 66045, 73815, 82251, 91390 etc.
# k = 10
task.pentatopeNo(10)
if __name__ == "__main__": main()
Output
1 5 15 35 70 126 210 330 495 715
# Ruby program for
# Pentatope number
class PentatopeNumber
def pentatopeNo(k)
n = 1
# Print all initial k pentatope number
while (n <= k)
# Formula
# (n (n + 1) (n + 2) (n + 3)) / 24
# Calculate nth pentatope number
result = n * (n + 1) * (n + 2) * (n + 3) / 24
# Display calculated result
print(" ", result)
n += 1
end
end
end
def main()
task = PentatopeNumber.new()
# Pentatope number are
# —————————————————————————————————————————————
# 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
# 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
# 8855, 10626, 12650, 14950, 17550, 20475, 23751,
# 27405, 31465, 35960, 40920, 46376, 52360,
# 58905, 66045, 73815, 82251, 91390 etc.
# k = 10
task.pentatopeNo(10)
end
main()
Output
1 5 15 35 70 126 210 330 495 715
// Scala program for
// Pentatope number
class PentatopeNumber()
{
def pentatopeNo(k: Int): Unit = {
var n: Int = 1;
// Print all initial k pentatope number
while (n <= k)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
var result: Int = n * (n + 1) *
(n + 2) * (n + 3) / 24;
// Display calculated result
print(" " + result);
n += 1;
}
}
}
object Main
{
def main(args: Array[String]): Unit = {
var task: PentatopeNumber = new PentatopeNumber();
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
task.pentatopeNo(10);
}
}
Output
1 5 15 35 70 126 210 330 495 715
// Swift 4 program for
// Pentatope number
class PentatopeNumber
{
func pentatopeNo(_ k: Int)
{
var n: Int = 1;
// Print all initial k pentatope number
while (n <= k)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
let result: Int = n * (n + 1) *
(n + 2) * (n + 3) / 24;
// Display calculated result
print(" ", result, terminator: "");
n += 1;
}
}
}
func main()
{
let task: PentatopeNumber = PentatopeNumber();
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
task.pentatopeNo(10);
}
main();
Output
1 5 15 35 70 126 210 330 495 715
// Kotlin program for
// Pentatope number
class PentatopeNumber
{
fun pentatopeNo(k: Int): Unit
{
var n: Int = 1;
// Print all initial k pentatope number
while (n <= k)
{
// Formula
// (n (n + 1) (n + 2) (n + 3)) / 24
// Calculate nth pentatope number
val result: Int = n * (n + 1) *
(n + 2) * (n + 3) / 24;
// Display calculated result
print(" " + result);
n += 1;
}
}
}
fun main(args: Array < String > ): Unit
{
val task: PentatopeNumber = PentatopeNumber();
// Pentatope number are
// —————————————————————————————————————————————
// 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001,
// 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315,
// 8855, 10626, 12650, 14950, 17550, 20475, 23751,
// 27405, 31465, 35960, 40920, 46376, 52360,
// 58905, 66045, 73815, 82251, 91390 etc.
// k = 10
task.pentatopeNo(10);
}
Output
1 5 15 35 70 126 210 330 495 715
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.
New Comment