Home » Write a program to find the Surface Area of a Triangular Prism

Write a program to find the Surface Area of a Triangular Prism

by Online Tutorials Library

Write a program to find the Surface Area of a Triangular Prism

Before writing the program of calculating the area of a triangular prism in different programming languages, firstly we have to know about the triangular prism and its formula.

What is Triangular Prism?

Triangular Prism is a 3-D shape, which has 5 faces, 6 vertices, and 9 edges.

Area of Triangular Prism

As, the prism contains 2 triangles and 3 rectangles. So,

Program of calculating the area of a triangular prism in different Programming languages

Program 1: Write a Program in C language:

Output of Above C program:

Surface area of the triangular prism  is: 181.000000  

Program 2: Write a Program in Java language:

Output of Above Java program:

The area of a triangular prism  is:  132.0  

Program 3: Write a Program in PHP programming language.

Output of Above PHP program:

33  

Program 4: Write a Program in Python programming language.

Output of Above Python program:

33  

You may also like