Today, we will learn how to calculate surface area of a triangle. We will use the formula for surface area:
area = 1 /2 x base x height
Therefore, we must have base and height of the given triangle. We will prompt the user to input base and height of given triangle. Then we will use the above mentioned formula to calculate area of the given triangle easily.
Basic Statements Used in this Program
The basic statements used to write this C language program are as follows:
- Pre processor directives to include header files stdio.h for input / output operations.
- Writing main() function
- variable declaration statements
- printf() function for displaying messages
- scanf() function for input
- Use assignment statement for calculating simple formula to calculate area of triangle
Source Code for C Program how to calculate surface area of a triangle
5,726 total views, 12 views today