- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

In this problem, we are given the side of a square (A) and the length and breadth of a rectangle (L and B). Our task is to create a Program to find Perimeter / Circumference of Square and Rectangle in C++.

To find the circumference of a square, we need the side of the square (a). For that, we will use the formula for the perimeter of the square which is

**4a**.To find the circumference of a rectangle, we need the Length (L) and breadth (B) of the rectangle. For that, we will use the formula for the perimeter of the rectangle which is

**2(L+B)**.

Square is a four-sided closed figure that has all four sides equal and all angle 90 degrees.

Formula for perimeter / circumference of square = (4 * a)

**Let’s take an example to understand the problem,**

**Input** − 5

**Output** − 20

**Input** − 12

**Output** − 48

#include <iostream> using namespace std; int calcCircumference(int a){ int perimeter = (4 * a); return perimeter; } int main() { int a = 6; cout<<"The Perimeter / Circumference of Square is "<<calcCircumference(a); }

The Perimeter / Circumference of Square is 24

Square is a four-sided closed figure that has opposite sides equal and all angle 90 degrees.

Formula for perimeter/circumference of square = *2 * (l + b)*

**Let’s take an example to understand the problem,**

**Input** − l = 7; b = 3

**Output** − 20

**Input** − l = 13; b = 6

**Output** − 38

#include <iostream> using namespace std; int calcCircumference(int l, int b){ int perimeter = (2 * (l + b)); w = return perimeter; } int main() { int l = 8, b = 5; cout<<"The Perimeter / Circumference of Rectangle is "<<calcCircumference(l, b); }

The Perimeter / Circumference of Rectangle is 26

- Related Questions & Answers
- C Program for Area And Perimeter Of Rectangle
- Program to find Circumference of a Circle in C++
- Program to find the Area and Perimeter of a Semicircle in C++
- Maximum area of rectangle possible with given perimeter in C++
- Java program to find the circumference of a circle
- C program to print area of triangle, square, circle, rectangle and polygon using switch case.
- C Program for Circumference of a Parallelogram
- Program to find perimeter of a polygon in Python
- Find Perimeter of a triangle in C++
- Program to calculate area and perimeter of equilateral triangle in C++
- Java Program to find the perimeter of a cylinder
- Program to calculate area and perimeter of Trapezium
- Find the perimeter of a cylinder in C++
- Sum of perimeter of all the squares in a rectangle using JavaScript
- Find the perimeter of a cylinder in Python Program

Advertisements