Dado el lado de un decágono, la tarea es encontrar el perímetro del decágono.
Explicación: en geometría, un decágono es un polígono de diez lados o 10-gon. Un decágono regular tiene todos los lados de igual longitud y cada ángulo interno siempre será igual a 144 grados.
Ejemplos :
Input : S = 5 Output : The Perimeter of Decagon is : 50 Input : S = 8 Output : The Perimeter of Decagon is : 80
La fórmula para encontrar el perímetro del decágono es:
Perimeter = 10 * S where "S" is the side of the Decagon
A continuación se muestra el programa para encontrar el perímetro del decágono:
C++
// C++ program to Calculate the Perimeter of a Decagon #include <iostream> 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 <stdio.h> // 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
<?php // PHP program to Calculate the Perimeter of a Decagon function CalPeri($s) { $Perimeter = 10 * $s; echo "The Perimeter of Decagon is : $Perimeter"; } // Driver Code $s = 5; CalPeri($s); ?>
Javascript
<script> // JavaScript program to Calculate the Perimeter of a Decagon // Function for finding the perimeter function CalPeri() { var S = 5, Perimeter; Perimeter = 10 * S; document.write("The Perimeter of Decagon is : " + Perimeter); } // Driver code CalPeri(); // This code contributed by gauravrajput1 </script>
Producción:
The Perimeter of Decagon is : 50
Complejidad de tiempo: O(1)
Espacio Auxiliar: O(1)
Publicación traducida automáticamente
Artículo escrito por Kanishk_Verma y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA