C Program to Find Perimeter of a Rectangle using Length and Width

In this tutorial you will learn about the C Program to Find Perimeter of a Rectangle using Length and Width and its application with practical example.

C Program to Find Perimeter of a Rectangle using Length and Width

In this tutorial, we will learn to create a C program that will Find the Perimeter of a Rectangle using Length and Width 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 rectangle?

The rectangle is four sides geometrical shape with pair of two sides parallel and of the same size as each other. The Rectangle has the length and the width in it.

The perimeter is the total of all the borders of the shape rectangle.

Algorithm:-

Program description:-

In this tutorial, we will create a program, that will find the Perimeter of the Rectangle. we will First, take the length and the width of the Rectangle from the user. Then we will calculate the Perimeter of the Rectangle using arithmetic expressions / the formulae for the Perimeter of the Rectangle. At last, we will print the Perimeter of the Rectangle.

Program Code:-

 

Output:-

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

  •  wd = it will hold the input value for the base of the Rectangle.
  •  lt = it will hold the input value for the height of the Rectangle.
  •  pmr = it will hold the value of the area of the Rectangle.

Taking the input width and the length of the Rectangle.

Calculating the Perimeter of the Rectangle.

Printing the Perimeter of the Rectangle.

In this tutorial we have learn about the C Program to Find Perimeter of a Rectangle using Length and Width and its application with practical example. I hope you will like this tutorial.