C Program to Find Area of a Trapezoid

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

C Program to Find Area of a Trapezoid

In this tutorial, we will learn to create a C program that will Find the Area of a Trapezoid 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 programming.

What is a Trapezoid?

The Trapezoid is a four-sided shape that has two sides that are parallel and two sides that are not parallel. Here, the shape has two different bases and the height for the trapezoid.

Algorithm:-

Program description:-

In this tutorial, we will create a program, that will find the Area of the Trapezoid. we will First, take the base 1 and 2 of the Trapezoid, then the height of the Trapezoid from the user. Then we will calculate the area of the Trapezoid using arithmetic expressions / the formulae for the area of the Trapezoid. At last, we will print the Area of the Trapezoid.

Program Code:-

Output:-

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

 

  •  bs1 = it will hold the input value for the base 1of the Trapezoid.
  •  bs2 = it will hold the input value for the base 2 of the Trapezoid.
  •  ar = it will hold the value of the area of the Trapezoid.

Taking the input bases and the height of the Trapezoid.

Calculating the area of the Trapezoid.

Printing the area of the Trapezoid. 

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