C Program to find Perimeter of a Rectangle using length and width

Write a C Program to find Perimeter of a Rectangle using length and width with example.

C Program to find Perimeter of a Rectangle using length and width

This program allows the user to enter the length and width of a rectangle. Using those values, C Programming will calculate the Perimeter of a rectangle.

TIP: If we know the length and width of a rectangle, we can calculate the perimeter of a rectangle using formula: Perimeter = 2 * (Length + Width)

/* C Program to find Perimeter of a Rectangle using length and width */
 
#include<stdio.h>
int main()
{
  	float width, length, Perimeter; 
 
  	printf ("\n Please Enter the Width of a Rectangle  :  ");
  	scanf ("%f",&width);

  	printf ("\n Please Enter the Length of a Rectangle :  ");
  	scanf ("%f",&length);
	   
  	Perimeter = 2 * (length + width);
 
	printf("\n Perimeter of a Rectangle =  %.2f", Perimeter);
 
  	return 0;
}
C Program to find Perimeter of a Rectangle using length and width