五维体数是帕斯卡三角形的任意一行中第五个数字,从左到右或从右到左开始,起始于5项行1 4 6 4 1。
这种数字的前几个是
1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365
Pentatope numbers belong in the class of figurate numbers, which can be represented as regular, discrete geometric patterns. The formula for the nth pentatopic number is
$$\left(\begin{array}{c}n+3\ 4\end{array}\right)=\left(\frac{n(n+1)+(n+2)+(n+3)}{24}\right)=\left(\frac{n^2}{4!}\right)$$
Accept the Nth Term from the User to find the Pentotope Numbers.
立即学习“C语言免费学习笔记(深入)”;
Use the formula
Shell本身是一个用C语言编写的程序,它是用户使用Linux的桥梁。Shell既是一种命令语言,又是一种程序设计语言。作为命令语言,它交互式地解释和执行用户输入的命令;作为程序设计语言,它定义了各种变量和参数,并提供了许多在高级语言中才具有的控制结构,包括循环和分支。它虽然不是Linux系统核心的一部分,但它调用了系统核心的大部分功能来执行程序、建立文件并以并行的方式协调各个程序的运行。因此,对于用户来说,shell是最重要的实用程序,深入了解和熟练掌握shell的特性极其使用方法,是用好Linux系统
24
$$\left(\begin{array}{c}n+3\ 4\end{array}\right)=\left(\frac{n(n+1)+(n+2)+(n+3)}{24}\right)=\left(\frac{n^2}{4!}\right)$$
/* Program to print pentatope numbers upto Nth term */
#include<stdio.h>
int main() {
int n, n1, nthterm, nthterm1, i;
clrscr();
printf("</p><p> Please enter the nth term to print Pentatope: ");
scanf("%d",&n);
nthterm = n * (n + 1) * (n + 2) * (n + 3) / 24;
printf("The Pentotpe Number is: ");
printf("%d", nthterm);
printf("</p><p></p><p>");
printf("Printing the Pentotope Numbers upto Nth Term");
printf("</p><p> Print Pentatope Numbers till the term: ");
scanf("%d",&n1);
printf("</p><p></p><p>");
printf("The Pentotope Numbers are:");
printf("</p><p></p><p>");
for (i = 1; i <= n1; i++){
nthterm1 = (i * (i + 1) * (i + 2) * (i + 3) / 24);
printf("%d\t", nthterm1);
}
getch();
return 0;
}
以上就是在C语言中编写一个程序,打印出N个五角数的序列的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号