C++ Program to Find Perimeter of a Rectangle

Write a C++ Program to Find the Perimeter of a Rectangle with an example. The math formula to get the rectangle perimeter = 2 * (length + width). In this C++ example, we use the same.

#include<iostream>

using namespace std;

int main()
{
	float width, length, perimeter;
	
	cout << "\nPlease Enter the Width of a Rectangle  =  ";
	cin >> width;
	
	cout << "\nPlease Enter the Length of a Rectangle =  ";
	cin >> length;
	
	perimeter = 2 * (length + width);
	
	cout << "\nPerimeter of a Rectangle =  " << perimeter;
	
 	return 0;
}
C++ Program to Find Perimeter of a Rectangle 1