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.


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

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.