C Program to Find Area of a Triangle using Base and Height

In this tutorial you will learn about the C Program to Find Area of a Triangle using Base and Height and its application with practical example.

C Program to Find Area of a Triangle using Base and Height

In this tutorial, we will learn to create a C program that will Find the Area of a Triangle using Base and Height in C programming.

Prerequisites

Before starting with this tutorial, we assume that you are the best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • Arithmetic Operations in C programing.

What is a triangle?

In geometry, a triangle is a shape used to be drawn by the three lines. The triangle has three interior angles and the total of its interior angle is 180 degrees.

Algorithm:-

Program description that will print the area of a Triangle:-

In this tutorial, we will create a program, that will find the area of a triangle using C programming. First, take the input height and the width of the triangle by the user. Then we will calculate the area of that triangle using the mathematical expression. At last, we will print the area of a triangle.

Program Code:-

 

Output:-

In the above program, we have first initialized the required variable.

 

  • bs = it will hold the value for the input base of the triangle.
  • ht  = it will hold the value for the input height of the triangle.
  • area = it will hold the integer value for the area of a triangle.

Input the base and height of the triangle.

Code to calculate the area of the triangle.

Printing output the area of an isosceles triangle.

In this tutorial we have learn about the C Program to Find Area of a Triangle using Base and Height and its application with practical example. I hope you will like this tutorial.