📜  五角锥角编号

📅  最后修改于: 2021-04-23 18:15:52             🧑  作者: Mango

五角星形数字是一类数字。它具有一个称为Pentacontahenagon的51面多边形。第N个五角锥角数是点的51个点,所有其他点都围绕着一个公共的共享角并形成图案。
五烯五苯酚的前几个数字是:

程序来找到第N个五角六边形编号

给定数字N ,任务是找到N数字。
例子:

方法:由以下公式给出第N个五角叉五烯酮数:

  • S面多边形的第N个项= \frac{((S - 2)N^{2} - (S - 4)N)}{2}
  • 因此,第51个面的多边形的第N个项由下式给出:

下面是上述方法的实现:

C++
// C++ program for the above approach
#include 
using namespace std;
 
// Function to find the N-th
// Pentacontahenagon Number
int PentacontahenagonNum(int N)
{
    return (49 * N * N - 47 * N)
        / 2;
}
 
// Driver Code
int main()
{
    int N = 3;
 
// Function Call
    cout << "3rd Pentacontahenagon Number is "
        << PentacontahenagonNum(N);
 
    return 0;
}


Java
// Java program for the above approach
import java.util.*;
class GFG{
 
// Function to find the N-th
// Pentacontahenagon Number
static int PentacontahenagonNum(int N)
{
    return (49 * N * N - 47 * N) / 2;
}
 
// Driver Code
public static void main(String[] args)
{
    int N = 3;
 
    // Function Call
    System.out.print("3rd Pentacontahenagon Number is " +
                                PentacontahenagonNum(N));
}
}
 
// This code is contributed by Rajput-Ji


Python3
# Python3 program for the above approach
 
# Function to find the N-th
# Pentacontahenagon Number
def PentacontahenagonNum(N):
 
    return (49 * N * N - 47 * N) // 2;
 
# Driver Code
N = 3;
 
# Function Call
print("3rd Pentacontahenagon Number is",
               PentacontahenagonNum(N));
 
# This code is contributed by Code_Mech


C#
// C# program for the above approach
using System;
class GFG{
 
// Function to find the N-th
// Pentacontahenagon Number
static int PentacontahenagonNum(int N)
{
    return (49 * N * N - 47 * N) / 2;
}
 
// Driver Code
public static void Main()
{
    int N = 3;
 
    // Function Call
    Console.Write("3rd Pentacontahenagon Number is " +
                             PentacontahenagonNum(N));
}
}
 
// This code is contributed by Code_Mech


Javascript


输出:
3rd Pentacontahenagon Number is 150