En matemáticas, un prisma triangular es una forma sólida tridimensional con dos extremos idénticos conectados por líneas paralelas iguales y tiene 5 caras, 9 aristas y 6 vértices.
donde “b” es la longitud de la base, “h” es la altura del triángulo, “s1, s2, s3” son las respectivas longitudes de cada lado del triángulo y H es la altura del prisma (que es también la longitud del rectángulo).
Dada la base, la altura del triángulo, la altura del prisma y la longitud de cada lado de la base del triángulo, la tarea es calcular el área de la superficie del prisma triangular.
Ejemplos:
Entrada: b = 3, h = 4, s1 = 3, s2 = 6, s3 = 6, Ht = 8
Salida: El área del prisma triangular es 132,000000
Entrada: b = 2, h = 3, s1 = 4, s2 = 5, s3 = 6, Ht = 8
Salida: El área del prisma triangular es 126.000000
Fórmula para calcular el área superficial:
Como se indicó anteriormente, el prisma contiene dos triángulos del área (1/2)*(b)*(h) y tres rectángulos del área H*s1, H*s2 y H*s3 .
Ahora, después de sumar todos los términos, obtenemos el área de superficie total:
SA = b * h + (s1 + s2 + s3 ) * H
C++
// C++ Program to calculate the // Surface area of a triangular prism #include <bits/stdc++.h> using namespace std; // Function for calculating the area void Calculate_area() { // Initialization float b = 3, h = 4, s1 = 3, s2 = 6; float s3 = 6, Ht = 8, SA; // Formula for calculating the area SA = b * h + (s1 + s2 + s3) * Ht; // Displaying the area cout << "The area of triangular prism is : " << SA; } // Driver code int main() { // Function calling Calculate_area(); return 0; }
C
// C Program to calculate the // Surface area of a triangular prism #include <stdio.h> // Function for calculating the area void Calculate_area() { // Initialization float b = 3, h = 4, s1 = 3, s2 = 6; float s3 = 6, Ht = 8, SA; // Formula for calculating the area SA = b * h + (s1 + s2 + s3) * Ht; // Displaying the output printf("The area of triangular prism is : %f", SA); } // Driver code int main() { // Function calling Calculate_area(); return 0; }
Java
// Java Program to calculate the // Surface area of a triangular prism import java.util.Scanner; public class Prism { public static void Calculate_area() { // Initialization double b = 3, h = 4, s1 = 3, s2 = 6; double s3 = 6, Ht = 8, SA; // Formula for calculating the area SA = b * h + (s1 + s2 + s3) * Ht; // Displaying the area System.out.printf("The area of triangular prism is : %f", SA); } public static void main(String[] args) { Calculate_area(); } } // This code is contributed by Nishant Tanwar
Python3
# Python3 Program to calculate the # Surface area of a triangular prism # Function for calculating the area def Calculate_area(): # Initialization b = 3 h = 4 s1 = 3 s2 = 6 s3 = 6 Ht = 8 # Formula for calculating the area SA = b * h + (s1 + s2 + s3) * Ht # Displaying the area print ("The area of triangular prism is :",SA) # Driver code if __name__ == '__main__': # Function calling Calculate_area() # This code is contributed by # Surendra_Gangwar
C#
// C# Program to calculate the // Surface area of a triangular prism using System; public class Prism { static void Calculate_area() { // Initialization double b = 3, h = 4, s1 = 3, s2 = 6; double s3 = 6, Ht = 8, SA; // Formula for calculating the area SA = b * h + (s1 + s2 + s3) * Ht; // Displaying the area Console.WriteLine("The area of triangular prism is : " + SA); } static public void Main(String[] args) { Calculate_area(); } }
PHP
<?php // PHP Program to calculate // the Surface area of a // triangular prism // Function for calculating // the area function Calculate_area() { // Initialization $b = 3; $h = 4; $s1 = 3; $s2 = 6; $s3 = 6; $Ht = 8; $SA; // Formula for calculating // the area $SA = $b * $h + ($s1 + $s2 + $s3) * $Ht; // Displaying the area echo "The area of triangular". " prism is : " , $SA; } // Driver code // Function calling Calculate_area(); // This code is contributed by m_kit ?>
Javascript
<script> // javascript Program to calculate the // Surface area of a triangular prism // Function for calculating the area function Calculate_area() { // Initialization let b = 3, h = 4, s1 = 3, s2 = 6; let s3 = 6, Ht = 8, SA; // Formula for calculating the area SA = b * h + (s1 + s2 + s3) * Ht; // Displaying the area document.write( "The area of triangular prism is : " +SA); } // Driver code // Function calling Calculate_area(); // This code is contributed by Rajput-Ji </script>
The area of triangular prism is : 132
Complejidad del 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