📜  计算十边形周长的程序

📅  最后修改于: 2021-10-23 08:37:18             🧑  作者: Mango

给定方S   十边形,任务是找出十边形的周长。
说明:在几何学中,十边形是一个十边形的多边形或十边形。规则的十边形所有边的长度相等,并且每个内角始终等于 144 度。

例子

Input : S = 5
Output : The Perimeter of Decagon is : 50

Input : S = 8
Output : The Perimeter of Decagon is : 80

寻找十边形周长的公式是:

Perimeter = 10 * S

where "S" is the side of the Decagon

下面是求十边形周长的程序:

C++
// C++ program to Calculate the Perimeter of a Decagon
#include 
using namespace std;
 
// Function for finding the perimeter
void CalPeri()
{
    int s = 5, Perimeter;
 
    Perimeter = 10 * s;
 
    cout << "The Perimeter of Decagon is : "
                                << Perimeter;
}
 
// Driver code
int main()
{
    CalPeri();
 
    return 0;
}


C
// C program to Calculate the Perimeter of a Decagon
#include 
 
// Function for finding the perimeter
void CalPeri()
{
    int s = 5, Perimeter;
 
    Perimeter = 10 * s;
 
    printf("The Perimeter of Decagon is : %d",
                                    Perimeter);
}
 
// Driver code
int main()
{
    CalPeri();
 
    return 0;
}


Java
/*package whatever //do not write package name here */
// Java program to Calculate the Perimeter of a Decagon
 
import java.io.*;
 
class GFG {
 
// Function for finding the perimeter
static void CalPeri()
{
    int S = 5, Perimeter;
 
    Perimeter = 10 * S;
 
    System.out.println("The Perimeter of Decagon is : "+
                                Perimeter);
}
 
// Driver code
    public static void main (String[] args) {
            CalPeri();
    }
}
//This Code is contributed by ajit


Python3
# Python3 program to Calculate
# the Perimeter of a Decagon
 
# Function for finding the
# perimeter
def CalPeri():
    s = 5
    Perimeter = 10 * s
 
    print ("The Perimeter of Decagon is : "
           , Perimeter)
 
# Driver code
if __name__ == '__main__':
    CalPeri();
 
# This code is contributed by
# Surendra_Gangwar


C#
// C# program to Calculate the
// Perimeter of a Decagon
using System;
 
class GFG
{
 
// Function for finding the perimeter
static void CalPeri()
{
    int S = 5, Perimeter;
 
    Perimeter = 10 * S;
 
    Console.WriteLine("The Perimeter of " +
                           "Decagon is : "+
                                Perimeter);
}
 
// Driver code
public static void Main ()
{
    CalPeri();
}
}
 
// This Code is contributed
// by anuj_67


PHP


Javascript


输出:
The Perimeter of Decagon is : 50