In this tutorial you will learn about the C Program to Find Area of a Parallelogram and its application with practical example.
C Program to Find Area of a Parallelogram
In this tutorial, we will learn to create a C program that will Find the Area of a Parallelogram 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 Parallelogram?
The Parallelogram is four sides geometrical shape with pair of two sides parallel and of the same size as each other. The parallelogram has the base and the height in it.
Algorithm:-
1 2 3 4 5 6 7 8 9 |
1. Declaring the required variables for the program. 2. Taking the input base and the height of the <strong>Parallelogram </strong>from the user. 3. <strong>C</strong><strong>alculating the Area of a Parallelogram </strong>using the arithmetic expression. 4. Printing the surface area and the volume of the <strong>Parallelogram</strong>. 5. End the program. |
Program description:-
In this tutorial, we will create a program, that will find the Area of the Parallelogram. we will First, take the base and the height of the Parallelogram from the user. Then we will calculate the area of the Parallelogram using arithmetic expressions / the formulae for the area of the Parallelogram. At last, we will print the Area of the Parallelogram.
Program Code:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
//C Program to Find Area of a Parallelogram #include <stdio.h>//including the header file for the program int main()//body of the main function { //declaring the required variables for the prorgam. float llbase, llheight, llarea; //llbase = it will hold the value for base of Parallelogram. //llheight = it will hold the value for height of Parallelogram. //Taking the input base of the Parallelogram printf("Enter the Parallelogram Base = "); scanf("%f",&llbase); //Taking the input height of the Parallelogram. printf("Enter the Parallelogram Height = "); scanf("%f",&llheight); //calculating the area of a Parallelogram llarea = llbase * llheight; //printing the Area of the Parallelogram printf("The Area of a Parallelogram = %.2f\n", llarea); return 0; } |
Output:-
In the above program, we have first initialized the required variable.
- llbase = it will hold the input value for the base of the parallelogram.
- llheight = it will hold the input value for the height of the parallelogram.
- llarea= it will hold the value of the area of the parallelogram.
Taking the input base and the height of the parallelogram.
Calculating the area of the parallelogram.
Printing the area of the parallelogram.