- 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

# Program to calculate area and perimeter of a rhombus whose diagonals are given What is rhombus in C++?

## What is rhombus?

In geometry, rhombus is a quadrilateral with four sides of same length. Rhombus resembles with the shape diamond. If the diagonals of rhombus meet at right angle than it becomes square.

Properties of rhombus are −

- equal sides
- Opposite sides are parallel and opposite angles are equal making it parallelogram
- diagonals bisects at right angle

Given below is the figure of rhombus

## Problem

Given with the diagonals, let’s say, d1 and d2 the task is to find the area and perimeter of a rhombus where area is the space occupied by the shape and perimeter is the space that its boundaries will cover

To calculate area and perimeter of a cuboid there is a formula −

## Example

Input-: d1=6 and d2=12 Output-: The perimeter of rhombus with given diagonals are :26 The area of rhombus with given diagonals are :36

## ALGORITHM

Start Step 1 -> declare function to calculate perimeter of rhombus int perimeter(int d1, int d2) Declare variable long long int perimeter Set perimeter = 2 * sqrt(pow(d1, 2) + pow(d2, 2)) Print perimeter Step 2 -> Declare function to calculate area of rhombus int area(int d1, int d2) Declare long long int area Set area = (d1 * d2) / 2 Print area Step 3 -> In main() Declare variable int d1 = 6, d2 = 12 Call perimeter(d1, d2) Call area(d1, d2) Stop

## Example

#include <iostream> #include <math.h> using namespace std; // program to calculate perimeter of rhombus int perimeter(int d1, int d2){ long long int perimeter; perimeter = 2 * sqrt(pow(d1, 2) + pow(d2, 2)); cout<< "The perimeter of rhombus with given diagonals are :"<<perimeter; } //program to calculate area of rhombus int area(int d1, int d2){ long long int area; area = (d1 * d2) / 2; cout<<"\nThe area of rhombus with given diagonals are :"<< area; } int main(){ int d1 = 6, d2 = 12; perimeter(d1, d2); area(d1, d2); return 0; }

## Output

The perimeter of rhombus with given diagonals are :26 The area of rhombus with given diagonals are :36

- Related Questions & Answers
- Program to find the perimeter of a rhombus using diagonals
- Area of circle inscribed within rhombus?
- Area of circle inscribed within rhombus in C Program?
- Program to calculate area and perimeter of Trapezium
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate area and perimeter of equilateral triangle in C++
- Program to print solid and hollow rhombus patterns in C
- C++ Program to get minimum perimeter of rectangle whose area is n
- Area of the biggest possible rhombus that can be inscribed in a rectangle in C Program?
- How to calculate the area and perimeter of a circle in JavaScript?
- Area of the biggest possible rhombus that can be inscribed in a rectangle in C?
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle What is Equilateral Triangle in C?
- C Program for Area And Perimeter Of Rectangle
- Program to calculate area and volume of a Tetrahedron
- Program to find the Area and Perimeter of a Semicircle in C++

Advertisements