十边形数是一个数字,它将三角形和方形数的概念扩展到了十边形(十边多边形)。n th 十边形数计算n个嵌套十边形图案中的点的数量,所有点共享一个公共角,其中 th 图案中的十边形有由相互间隔一个单位的i点构成的边。第n个十边形数由公式D(n)=4n给出 2. -3n; 前几个十边数是: 0, 1, 10, 27, 52, 85, 126, 175, 232, 297, 370, 451, 540, 637, 742, 855, 976, 1105, 1242……
null
Input : n = 2 Output : 10 Input : n = 5 Output : 85 Input : n = 7 Output: 175
// C program to find nth decagonal number #include <stdio.h> #include <stdlib.h> // Finding the nth Decagonal Number int decagonalNum( int n) { return (4 * n * n - 3 * n); } // Driver program to test above function int main() { int n = 10; printf ( "Decagonal Number is = %d" , decagonalNum(n)); return 0; } |
输出:
Decagonal Number is = 370
参考资料: 数学世界
本文由 丹麦拉扎 .如果你喜欢GeekSforgek,并想贡献自己的力量,你也可以使用 贡献极客。组织 或者把你的文章寄到contribute@geeksforgeeks.org.看到你的文章出现在Geeksforgeks主页上,并帮助其他极客。
如果您发现任何不正确的地方,或者您想分享有关上述主题的更多信息,请写下评论。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END